Video file .ogv plays locally in Firefox, but not from server

后端 未结 1 1730
粉色の甜心
粉色の甜心 2020-12-23 22:26

I\'m not having any problems playing this video in Chrome, Safari or Opera. When I try to play it in Firefox, I get a grey box with no video. Here is my code:



        
相关标签:
1条回答
  • 2020-12-23 23:12

    The MIME-type from your server for the fracWelDay3.ogv video is incorrectly being served as `text/plain'.

    $ curl -I http://www.synergese.co.uk/testMathsOnline/day3/videos/fracWelDay3.ogv

    Notice that Content-Type is text/plain instead of video/ogg:

    HTTP/1.1 200 OK
    Date: Thu, 26 May 2011 21:55:25 GMT
    Server: LiteSpeed
    Accept-Ranges: bytes
    Connection: close
    ETag: "fa8cc4-4dde175c-0"
    Last-Modified: Thu, 26 May 2011 09:03:24 GMT
    Content-Type: text/plain
    Content-Length: 16420036
    

    The HTML5 video plays for me in Safari, Chrome and IE 9 but not Firefox or IE 7-8. If you fix the MIME-type issue, it will play in Firefox.

    If you’re using the Apache web server or some derivative of Apache, you can use an AddType directive in your site-wide httpd.conf or in an .htaccess file in the directory where you store your video files. (If you use some other web server, consult your server’s documentation on how to set the Content-Type HTTP header for specific file types.)

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

    The first line is for videos in an Ogg container. The second line is for videos in an MPEG-4 container. The third is for WebM. Set it once and forget it. If you forget to set it, your videos will fail to play in some browsers, even though you included the MIME type in the type attribute in your HTML markup.

    0 讨论(0)
提交回复
热议问题