问题
If I paste the following URL directly into the address bar in Firefox, the video plays just fine:
http://distilleryvesper1-13.ak.instagram.com/744b42900fab11e3a34522000ae80008_101.mp4
However, as soon as I wrap it in HTML5 video tags (as in this Fiddle), Firefox claims that the video isn't supported:
<video width="612" height="612" controls>
<source src="http://distilleryvesper1-13.ak.instagram.com/744b42900fab11e3a34522000ae80008_101.mp4" type="video/mp4">
</video>
I'm using Firefox version 24.0.
Any ideas?
回答1:
MP4 is not supported in Firefox through the video element unless you are on Vista (since version 22), Windows 7 (since version 21) and 8, Linux (since version 24 but disabled by default until version 26) and Android (since version 17) and then only if a third-party decoder is available for it (source).
Update 1 (2014) Current plans is to also support MP4 for Mac from version 35 (released early next year),
Update 2 (2016) It's supported through native APIs since v35.
Also from Mozilla Developer Network:
Firefox supports the format on some platforms, but only when a third-party decoder is available.
That it plays when you supply the link directly indicates that you have a plugin installed which is capable of showing mp4 (ie. QuickTime or something similar). This and the video element are unrelated however.
To get around this you can supply OGG Vorbis and/or WebM formats. You can use a free converter such as Miro to support these formats which are supported also in Firefox.
回答2:
FYI, Firefox 35 offered up native support on OSX and Windows in early 2015. https://www.mozilla.org/en-US/firefox/35.0/releasenotes/
回答3:
You are probably on Mac and you have the QuickTime plug-in installed, so the plug-in plays the video if you navigate directly to it, but it doesn't work in the video
element, because Mac support for MP4/H.264/AAC isn't ready yet.
As of November 2013 / Firefox 26, Firefox supports MP4/H.264/AAC on Vista and newer Windows, Android and Firefox OS.
Your Fiddle also works on Linux when GStreamer support is enabled and encumbered codecs are installed. (GStreamer support is not yet enabled by default in e.g. builds supplied by Canonical for Ubuntu.)
回答4:
you may be needing this in case you do not have support for MP4 files:
Windows Media Feature Pack for Windows 7 N and for Windows 7 KN:
http://support.microsoft.com/kb/968211
http://www.microsoft.com/en-us/download/details.aspx?id=16546
Also make sure that these prefs have the default value:
media.windows-media-foundation.enabled
media.directshow.enabled
来源:https://stackoverflow.com/questions/20061175/mp4-not-supported-in-firefox