我在我的网站上使用了mediaelement.js
,我用的例子是带有H.264编解码器的.mp4文件,适用于所有浏览器,但是当我发布网站时,它在任何版本的Internet Explorer中都不起作用。在我的localhost上,它没有任何问题(闪回后备效果很好),但在我的服务器中它不起作用。
我使用的代码是:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>VIDEO HTML5</title>
<script type="text/javascript" src="player_files/jquery.js"></script>
<script type="text/javascript" src="player_files/mediaelement-and-player.min.js"></script>
<link href="player_files/mediaelementplayer.min.css" rel="Stylesheet" />
</head>
<body>
<video id="video1" src="http://www.teletica.com/html5/videos/precious.mp4" width="640" height="360" poster="http://www.teletica.com/html5/videos/precious.jpg" controls="controls" preload="none"></video>
<video width="640" height="360" id="video2" poster="videos/precious.jpg" controls="controls" preload="none">
<source type="video/mp4" src="http://teletica.com/html5/videos/precious.mp4" />
<source type="video/webm" src="http://teletica.com/html5/videos/precious.webm" />
<object width="640" height="360" type="application/x-shockwave-flash" data="player_files/flashmediaelement.swf">
<param name="movie" value="player_files/flashmediaelement.swf" />
<param name="flashvars" value="controls=true&file=http://teletica.com/html5/videos/precious.mp4" />
<img src="player_files/precious.jpg" width="640" height="360" alt="Here we are" title="No video playback capabilities" />
</object>
</video>
<script type="text/javascript">
$('video, audio').mediaelementplayer();
</script>
球员在这方面工作http://www.teletica.com/html5
。
我遇到了同样的问题,并在another post中找到了一个未记录的功能:mode:shim
~不确定它的用途,具体来说,但它似乎迫使所有浏览器重新使用闪存。
由于chrome,ios等人正在使用html5视频,我使用条件注释来指定IE9并强制退回(flash或silverlight):
var player = new MediaElementPlayer('video', {
/*@cc_on
@if (@_jscript_version == 9)
mode: 'shim',
@end
@*/
// remove or reorder to change plugin priority
plugins: ['flash','silverlight'],
// etc...
}
感谢上百万的调查工作和解决方案 - 我最终得到了稍微分开的代码
var options = {...}
/*@cc_on
@if (@_jscript_version == 9)
options.mode = 'shim';
@end
@*/
$('video, audio').mediaelementplayer(options);
只是把它放在这里,以便其他人看到它,我尝试使用此代码
/*@cc_on
@if (@_jscript_version == 9)
mode: 'shim',
@end
@*/
我最终在Internet Explorer 9中遇到了问题,似乎浏览器正在制作我的视频的另一个实例,而其他所有实例都无法控制。我最终选择了这个。
if($.browser.msie && ($.browser.version == '8.0' || $.browser.version
== '7.0'))
options.mode = 'shim';
由于您的系统仅存在问题,因此您的设置或Flash播放器可能存在问题。以下是您可以尝试的一些事项:
您还可以重新安装Internet Explorer并查看它是否有效。祝一切顺利! :)