damon
damon

Reputation: 8467

embed video in html page and make it play any video file in local drive

I want to embed video in html page sothat I can play any multimedia file from my hard drive or from a url.I tried to create a web page with

<video src="test.mp4" controls width="320" height="240">

</video>

In chrome,the video plays without any problem. However,the mp4 file is not recognized in firefox .It displays error message- 'no video with supported format or mimetype found'.

It so happens that most of my video files are .mp4 or .flv files.

If I put <source src="test.flv" /> in the video element ,then both chrome and firefox fail to show it.

So,what should I do to play at least mp4 and flv files in both browsers?.

Any pointers /advice most appreciated.

Upvotes: 4

Views: 34516

Answers (1)

Anthony
Anthony

Reputation: 37045

From Mozilla's page on browser-supported audio/video formats:

The MPEG container format with the H.264 video codec and either the AAC audio codec or the MP3 audio codec is supported by Internet Explorer and Safari. Firefox and Opera do not support the format. Support for the format is deprecated in Chrome, and Chromium does not support it either.

The MPEG media formats are covered by patents, which are not freely licensed. All the necessary licenses can be bought from MPEG LA. Since H.264 is currently not a royalty free format, it is unfit for the open web platform, according to Mozilla [1, 2], Google [1, 2] and Opera.

Short answer, Firefox doesn't support mp4, as it's not open source. But it does support multiple sources and will play the first one it supports.

Further, it doesn't appear that swf or flv are supported by any browsers, since they are totally Adobe and require Flash Player, but the following should work around that:

<video src="test.mp4" controls>
    <object data="test.flv" type="application/x-shockwave-flash">
      <param value="test.flv" name="movie"/>
    </object>
</video>

Be aware that the above had .swf file as data and value originally; I haven't tested if .flv will work on its own.

Upvotes: 4

Related Questions