Brady Zhu
Brady Zhu

Reputation: 1405

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.

Upvotes: 0

Views: 208

Answers (2)

Prime
Prime

Reputation: 3625

Try jplayer which is compatible with Windows : IE6, IE7, IE8, IE9, IE10, IE11 and also works well on Opera mini and android browser.

http://www.jplayer.org/

Upvotes: 1

Ian Devlin
Ian Devlin

Reputation: 18870

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.

Upvotes: 0

Related Questions