开发者

Opera and HTML5 video

开发者 https://www.devze.com 2023-02-22 09:33 出处:网络
On my website, I have video in mp4 and ogv formats. mp4 plays in webkit browsers. ogv plays in Firefox, but don\'t want in Opera.

On my website, I have video in mp4 and ogv formats. mp4 plays in webkit browsers. ogv plays in Firefox, but don't want in Opera.

There is a trivial HTML:

<video poster="my_video.jpg" co开发者_运维百科ntrols="controls">
    <source src="my_video.mov" type="video/mp4" />
    <source src="my_video.ogv" type="video/ogg; codecs='theora, vorbis'" />
</video>

When i open up a page, i see video element with poster, but when i'm clicking play button, nothing happens. I don't see loading progress and everything still as is. But Firefox plays it fine.

In Opera's network inspector, i see following HTTP Header for .ogv video file request:

GET /my_video.ogv HTTP/1.1

User-Agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; ru) Presto/2.7.62 Version/11.01

Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, /;q=0.1

"Accept" part is confusing me. Why it accepts these content types for video ?

Any ideas ?


For Opera, you really only need to have these two mime types added to Apache or any server you would be using.

AddType video/ogg .ogv
AddType audio/ogg .oga

Is this video working for you? Do you have a link to the video you are trying to play?


I've figured it out.

I has MIME types, listed in YAML file, that should be specified on Mongrel loading:

/usr/bin/mongrel_rails -m /path_to_mime_types.yml

I only has ".ogv: video/ogg" there. But, according to HTML5 video problem, Opera needs more:

.ogv: video/ogg
.oga: audio/ogg
.ogg: application/ogg
.webm: video/webm
.mp4: video/mp4

When i added these types, Opera will play .ogv video.

Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消