ffmpeg - mp4 plays in safari unless it is not the first source? Chrome wont play same mp4?

China☆狼群 提交于 2019-12-11 04:56:17

问题


Yet another issue trying to get html5 video working.

I have created 3 versions of the same video in 3 different formats using ffmpeg: mp4, ogg, and webm.

The .ogg plays fine in chrome when listed as the first html5 video source, and the .mp4 plays fine in safari when listed as the first html5 video source, however, if I list the .mp4 source above the .ogg source, chrome will no longer load/play the .ogg video as it is defaulting to the .mp4 video which will not play, and in the same fashion, if I list the .ogg source file above the .mp4 source file, safari will not load the .mp4 video.

I am at a loss. Here is my embed code:

<video width="100%" height="100%">
    <source src="./videos/Wildlife.ogg">
    <source src="./videos/Wildlife.webm">
    <source src="./videos/Wildlife.mp4">
</video>

Any ideas as to why the fallbacks between sources are is not working properly?

Why isn't safari obeying the fallback order and ignoring the .ogg/.webm files?


回答1:


After quite a bit of troubleshooting, and adding/removing tags, I finally got the fallbacks to work properly by listing their types.

<video width="100%" height="100%">
    <source src="./videos/Wildlife.ogg" type="video/ogg">
    <source src="./videos/Wildlife.webm" type="video/webm">
    <source src="./videos/Wildlife.mp4" type="video/mp4">
</video>

In other words, in my case, the browsers would not fallback to the next available (playable) video format unless I added the 'type=' attributes on each video type.



来源:https://stackoverflow.com/questions/17379382/ffmpeg-mp4-plays-in-safari-unless-it-is-not-the-first-source-chrome-wont-play

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!