Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
671 views
in Technique[技术] by (71.8m points)

html - Videos not playing in browsers

I am having 6 different types of video formats, namely .avi, .mkv, .mov, .ogv, .wmv, .mp4. I tried to embed these videos to the browsers using video tag in HTML5. But no videos played in any browsers. In Firefox it shows "no video with supported mime type". In Chrome only .mp4 video is playing rest of the videos are not playing. In IE8 it shows nothing. Here is my HTML code:

<video width="300" height="200" controls>
    <source src="videos/airhorse_avi.avi" type="video/avi" title="Avi Videos">
</video>
<video width="300" height="200" controls>
    <source src="videos/airhorse_mkv.mkv" type="video/mkv" title="Mkv Videos">
</video>
<video width="300" height="200" controls>
    <source src="videos/airhorse_mov.mov" type="video/mov" title="Mov Videos">
</video>
<video width="300" height="200" controls>
    <source src="videos/airhorse_ogv.ogv" type="video/ogv" title="Ogv Videos">
</video>
<video width="300" height="200" controls>
    <source src="videos/airhorse_wmv.wmv" type="video/wmv" title="Wmv Videos">
</video>
<video width="300" height="200" controls>
    <source src="videos/spielberg_mp4.mp4" type="video/mp4" title="Mp4 Videos">
</video>

Is that possible of playing all these videos in any browsers like firefox, chrome, IE, safari, opera.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The simple answer is that for various reasons not all browsers support all the available codecs/containers.

There is a fairly up-to-date list here http://en.wikipedia.org/wiki/HTML5_video and this answer shows how you can test specific support yourself Mobile detection for specific parts of websites

You mention (in one of the comments) that you get an error thrown ... if you let us know what error that is (if the canPlayType() doesn't answer the question) then we could research some more


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...