问题
I have been trying to get VideoJS to play the demo video for 2 days with no luck in IE8. I can get it to play in Firefox, Chrome and Safari. All I get is a black box where the video should be. The page is simple. Can anyone shed som elight on this for me?
Thanks...
Source is:
<!doctype html>
<!--[if lt IE 7]><html class="no-js ie6 oldie" lang=en><![endif]-->
<!--[if IE 7]><html class="no-js ie7 oldie" lang=en><![endif]-->
<!--[if IE 8]><html class="no-js ie8 oldie" lang=en><![endif]-->
<!--[if gt IE 8]><!--> <html class=no-js lang=en> <!--<![endif]-->
<head>
<meta charset=utf-8>
<title>Test VideoJSPlayback</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<link rel=stylesheet href="http://vjs.zencdn.net/3.2/video-js.css" type="text/css">
<script type="text/javascript" src="http://vjs.zencdn.net/3.2/video.js"></script>
<script src="http://www1.videojs.com/js/libs/modernizr-2.0.6.min.js"></script>
</head>
<body>
<div id=player_box>
<video id=home_video class="video-js vjs-default-skin" controls preload=none width=640 height=264
poster="http://video-js.zencoder.com/oceans-clip.jpg">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'/>
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm'/>
<track kind=captions src="/video-js/captions.vtt" srclang=en label=English />
</video>
<script>var homePlayer=_V_("home_video");</script>
</div>
</body>
</html>
回答1:
As you probably know IE 8 does not support HTML5 video playback, so what video-js does is utilize video-js.swf to encode the mp4 file and serve a "Flash version" without the need for additional files.
Add quotations to your video tag.
<video id="home_video" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"> ... </video>
Also, In your video-js JavaScript file search for "video-js.swf" find where this file is being referenced, if you are using a local version be sure the path is correct, if not, be sure you are not recieving any JavaScript errors in IE due to cross domain file Interpretation or MIME errors.
回答2:
Make sure you have a poster image set. For some reason, the Flash player used by IE8 doesn't work if you don't set a poster image.
I had this same issue, and once I set an image for the poster, it started working in IE8.
来源:https://stackoverflow.com/questions/15912082/videojs-wont-play-in-ie8-but-plays-in-firefox-chrome-and-safari