简体   繁体   中英

How to play videos on HTML page with cross-browser compatibility?

Our application has a lot of videos to play on HTML page, at the beginning. I tried both object and video tags to play these videos, but I found the problem of cross-browser compatibility, these 2 tags can't work well on IE 6/7/8 . Absolutely, we are not able to develop a new video player to do it, and I guess video playing is a very common case for Java EE development, so I want to ask if there is any good way for us to play videos with good cross-browser compatibility.

Thanks.

尝试与Windows兼容的jplayer:IE6,IE7,IE8,IE9,IE10,IE11,并且在Opera mini和android浏览器上也能很好地工作。

http://www.jplayer.org/

Doing something like the following will allow you to play videos on most browsers:

<video controls>
   <source src="myVideo.mp4" type="video/mp4">
   <source src="myVideo.webm" type="video/webm">
   <object type="application/x-shockwave-flash" data="player.swf?videoUrl=myVideo.mp4">
      <param name="movie" value="player.swf?videoUrl=mVideo.mp4">
   </object>
</video>

In this case player.swf is a Flash player such as those available with popular video players like MediaElementJs (which of course you could simply use instead) which plays MP4 files. Or if you have a Flash flv file you can play it here without the player.swf .

You should also include the html5shiv file so that the video element is not ignored by these older browsers.

But you may have tried all this, so an example of the code you tried that didn't work would be useful to see.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM