.ogg video not playing in firefox

2020-08-11 11:11发布

问题:

We're just getting started with html5 video, and cannot seem to get .ogg files to play in Firefox, any tips? Here is the source we are using:

<video width="640" height="360" poster="http://video.thewebreel.com/episode_001/episode_001.jpg" controls autoplay autobuffer>
  <source src="http://video.thewebreel.com/episode_001/episode_001.ogg" type="video/ogg" type='video/ogg; codecs="theora, vorbis"'/>
  <source src="http://video.thewebreel.com/episode_001/episode_001.mp4" type="video/mp4" />
</video>

The live example can be seen here:

http://thewebreel.com/2010/05/02/episode-1.html

However we are totally baffled, everything seems exactly right.

回答1:

I uploaded your .ogg to my server suspecting it was a server issue and it's working fine on my server

I'm guessing it's because your web server is replying with

Content-type: binary/octet-stream

Try adding the mime types to nginx...

Open up the Nginx mime type configuration file, eg: /etc/nginx/mime.types

Add these lines after the last video mime type

video/ogg                             ogm;
video/ogg                             ogv;
video/ogg                             ogg;


回答2:

In one of the links mentioned, the correct way to play ogg files is..

<audio preload="auto" controls="controls">
  <source src="media/song.ogg" type="application/ogg">
</audio>

Thanks to the person who pointed it out here. HTML5 video (mp4 and ogv) problems in Safari and Firefox - but Chrome is all good



回答3:

The correct mime types to set on your server are

AddType audio/ogg .oga (audio oga file)
AddType video/ogg .ogv (video ogv file)
AddType application/ogg .ogg (for audio and video)

Sources:

  • http://wiki.xiph.org/MIME_Types_and_File_Extensions
  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Configuring_servers_for_Ogg_media


回答4:

Ogg videos play were playing on Firefox 3.6 but not 4.0.

Here's the solution: video autobuffer controls preload="auto" instead of video controls preload="none"

This works in Firefox 3.6 and 4.0 and now MSIE 9!