The HTML5 media player of SMF Framework has just a few media codecs like ogg vorbis, and mp4, so is there any way to play a media file of say, flv format or mkv or mp3 format? And also, is there any way with which we can play local media files if the above case is satisfied?
Asked
Active
Viewed 426 times
1 Answers
1
Because of the browser support of video codecs in HTML5 Video, you can use only a few codecs in those. Also not all browsers support all video codecs. So you have to provide one H264 video in the mp4 Container (IE, Safari, Chrome) and a Ogg Theora video. You can transcode your Videos with a lot of free desktop tools like this one. You have to provide the different files like that:
<video id="myVideo" class="pf-video" width="480" height="320" controls="controls" poster="../media/bigbuck.png">
<source src="../media/bigbuck.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="../media/bigbuck.ogv" type='video/ogg; codecs="theora, vorbis"' />
</video>
Hope I could help you.

Martin
- 381
- 4
- 17
-
yeah, i know that, but this is on the browser side, and the user gets to select a file and then playback it, so isn't there any way to do it on the fly on the browser itself? @Martin Haug – Anuj Kaithwas Aug 01 '12 at 13:10
-
Not any easy way.You maybe can write a transcoding tool in JS, but that would require an extremely performant System and a stunning fast JS execution. In Addition, it would be hard to code. There hasn't yet been a JS file for that. But if you could write one you'll get very famous ;) – Martin Aug 01 '12 at 17:38
-
Hey, I got what you meant to say. Can you give an example of providing one H.264 video and one in Ogg Theora? like an illustration of how to use that or get it done in the webpage or when the user wishes to play a file that isn't in either one format? – Anuj Kaithwas Aug 02 '12 at 12:07
-
1If you do it like in the answwer, the browser will play the first file it can play. You can add WebM videos, too, to add more codecs. If the browser can play none of the videos, it will parse any other code in the video tag. E. g. you can use a Flash or Silverlight fallback with an error-message with download links for the .mp4 as fallback for Flash or SL. – Martin Aug 04 '12 at 08:06