Playing MP4 files in Firefox using HTML5 video

104,793

Solution 1

This is caused by the limited support for the MP4 format within the video tag in Firefox. Support was not added until Firefox 21, and it is still limited to Windows 7 and above. The main reason for the limited support revolves around the royalty fee attached to the mp4 format.

Check out Supported media formats and Media formats supported by the audio and video elements directly from the Mozilla crew or the following blog post for more information:

http://pauljacobson.org/2010/01/22/2010122firefox-and-its-limited-html-5-video-support-html/

Solution 2

I can confirm that mp4 just will not work in the video tag. No matter how much you try to mess with the type tag and the codec and the mime types from the server.

Crazy, because for the same exact video, on the same test page, the old embed tag for an mp4 works just fine in firefox. I spent all yesterday messing with this. Firefox is like IE all of a sudden, hours and hours of time, not billable. Yay.

Speaking of IE, it fails FAR MORE gracefully on this. When it can't match up the format it falls to the content between the tags, so it is possible to just put video around object around embed and everything works great. Firefox, nope, despite failing, it puts up the poster image (greyed out so that isn't even useful as a fallback) with an error message smack in the middle. So now the options are put in browser recognition code (meaning we've gained nothing on embedding videos in the last ten years) or ditch html5.

Share:
104,793
TJ Sherrill
Author by

TJ Sherrill

I run a Seattle Website Development firm

Updated on July 09, 2022

Comments

  • TJ Sherrill
    TJ Sherrill almost 2 years

    I have searched around quite a bit but have not solved my problem.

    I have a video tag running as follows:

    <video 
      class="ne" 
      src="{{ page | video_url }}" 
      muted="true" 
      volume="0"  
      controls 
      width="720" 
      height="480" 
      poster="{{ page | video_poster_image_url }}" 
      type="video/mp4">
    </video>
    

    I am using Jekyll for the URLs. They work fine.

    The site is live at switzerlandllc.com. Click any video in FF and it shows an image and an X. Chrome and other browsers work fine.

    If you grab the source of a video and load it in a new tab it plays fine. At least it does for me.

    I have added:

    AddType video/ogg .ogv
    AddType video/mp4 .mp4
    AddType video/webm .webm
    

    to my htaccess file. I suspect that I don't need the .ogv or .webm.

    I don't understand why loading the video URL will play the videos fine but loading the video into a video tag fails.

    Any ideas?

  • Sam Dufel
    Sam Dufel about 12 years
    Direct from the source: developer.mozilla.org/En/…
  • TJ Sherrill
    TJ Sherrill about 12 years
    I have seen this answer around but then why does the video play if you load the path in a new tab?
  • Josh Mein
    Josh Mein about 12 years
    I assume the issue is that in order to support mp4 in their video tag, the Firefox crew would have to pay for a license. Whereas, if the user just puts the link in the browser, they dont have to pay anything.
  • mpdonadio
    mpdonadio about 12 years
    @TJSherrill, it is probably playing because of a Firefox plugin (like Quicktime). This doesn't mean it will work in a <video> element.
  • TJ Sherrill
    TJ Sherrill about 12 years
    So even to setup a flash fall back I would have to have another version of the video in a .ogg or other format.
  • Josh Mein
    Josh Mein about 12 years
    I am not positive, but I believe flash is completely different. My guess would be that you could use mp4 in a flash player. Let me know what you find out though.
  • franzlorenzon
    franzlorenzon over 10 years
    From Firefox 21, and from Windows Vista, it can handle mp4 videos (using the codecs of the underlying OS).
  • Geo
    Geo over 10 years
    +1 "Firefox is like IE all of a sudden, hours and hours of time, not billable."
  • Boaz
    Boaz about 9 years
    Firefox 36 now supports mp4 videos