Search code examples
javascripthtmlvideo-streaminghtml5-videofirefox-os

Firefox OS: How to implement mp4 and m3u8 streaming


I want to make a Firefox-OS application to stream video files in .mp4 (H.264) and later in .m3u8 format. With the <video> tag I tried the following code.

<video width="80%" height="80%" controls>
  <source src="http://example.com/video_podcast_h264_q10.mp4" type="video/mp4">
Your browser does not support the video tag.
</video> 

In my GeeksPhone and in Firefox Browser on Mac I see only a black screen with the text saying: "no video with supported format and mime-type found"

On my server side app I placed a .htaccess file with: AddType video/mp4 .mp4

How do I implement live .mp4 streaming for Firefox-OS (i.e. for Geeks Phone) ?? Any suggestions or links to working code?


Solution

  • According to this MDN article:

    Currently, for security reasons, the h.264 decoder on Firefox OS devices is only available to privileged code. Because of that, you can't use the element to present h.264 content at this time. You can, however, use a Web Activity. Here's a code snippet that can help:

    var activity = new MozActivity({
      name: "view",
      data: {
        type: [
          "video/webm",
          "video/mp4",
          "video/3gpp",
          "video/youtube"
        ],
        url: "http://example.com/myvideo.mp4"
      }
    });
    

    I've read elsewhere that there may be size limits, so you may want to experiment with that.

    More information on Web Activities here: https://hacks.mozilla.org/2013/08/web-activities-firefox-os-the-platform-html5-deserves/