IE8下实现视频播放 IE8下实现MP4播放 IE8 MP4 IE 兼容 MP4

一种调用flash播放 参考第一种写法。

重点说一下 第二种 一个是<object > 标签 一个是embed 标签 是为了兼容更多浏览器。

<!--播放flash 写法 begin-->
<!--<embed allowscriptaccess="sameDomain" allowNetworking="all" invokeurls="true" src="flash路径.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
quality="high" autostart="0" wmode="direct"
width="100%" height="100%"
align="middle"
allowFullScreen="true"
allowScriptAccess="always"
scale="showall"
FlashVars="">-->
<!--播放flash 写法 end-->

<!--IE9及以上写法 begin-->
<video id="video" controls="controls">
<source id="videoSrc" src="路径.mp4" type="video/mp4" />
</video>
<!--IE9及以上写法 end-->


<!--IE8 播放MP4写法1 begin-->
<!--<embed id="flash" allowscriptaccess="sameDomain" allowNetworking="all" invokeurls="true" src="路径.mp4" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
quality="high" autostart="0" wmode="direct"
width="100%" height="100%"
align="middle"
allowFullScreen="true"
allowScriptAccess="always"
scale="showall"
FlashVars="">-->
<!--IE8 播放MP4写法1 end-->


<!--IE8 播放MP4写法2 begin-->
<p id="flash" style="text-align: center;display:none ">
<object id="MediaPlayer"
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="800"
height="600" standby="Loading Windows Media Player components…"
type="application/x-oleobject"
codebase=" style="color:#0000CC;">
<param name="FileName" value="路径.mp4">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="BufferingTime" value="2">
<param name="ShowStatusBar" value="true">
<param name="AutoSize" value="true">
<param name="InvokeURLs" value="false">
<param name="AnimationatStart" value="1">
<param name="TransparentatStart" value="1">
<param name="Loop" value="1">
<embed type="application/x-mplayer2" src="路径.mp4"
name="MediaPlayer" autostart="1" showstatusbar="1" showdisplay="1"
showcontrols="1" loop="0" videoborder3d="0"
pluginspage=""
width="800" height="600"></embed>
</object>
</p>
<!--IE8 播放MP4写法2 end-->

动态生成 src 写法如下

if (ieVersion == 'IE8.0') {

$("#video").hide();
var flash="";
flash += "<embed id='flash' style='width:100%;height:" + height + "px;' allowscriptaccess='sameDomain' allowNetworking='all' invokeurls='true' ";
flash += "src='" + src + "' ";
flash +="pluginspage='http://www.macromedia.com/go/getflashplayer' ";
flash +="type='application/x-shockwave-flash' ";
flash +="quality='high' autostart='0' wmode='direct' ";
flash +="width='100%' height='100%' ";
flash +="align='middle'";
flash +="allowFullScreen='true' ";
flash +="allowScriptAccess='always' ";
flash +="scale='showall' ";
flash +="FlashVars=''/> ";
$("#flash").html(flash);
$("#flash").show();

} else {

$("#video").attr("height", height+"px");
$("#videoSrc").attr("src", src + queryStr("path"));
}

-------------------------------------------------------------------我是割鸡 割鸡 -------------------------------------------------------------------

页面全部代码如下

<!DOCTYPE html>
<!-- saved from url=(0052)http://cdn-dl.insta360.com/event/event-bikini/flash/ -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试player</title>
<meta charset="UTF-8">
<!--支持IE8版本 jq-->
<script src="../../Resource/jquery-1.10.2.js"></script>
<script src="../../Resource/jquery-1.10.2.min.js"></script>
<script src="../../Resource/jquery.cookie.min.js"></script>
<style type="text/css" media="screen">
html,
body {
height: 100%;
background-color: #ffffff;
}

body {
margin: 0;
padding: 0;
overflow: hidden;
}

#flashContent {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="flashContent">
<!--播放flash 写法 begin-->
<!--<embed allowscriptaccess="sameDomain" allowNetworking="all" invokeurls="true" src="flash路径..swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
quality="high" autostart="0" wmode="direct"
width="100%" height="100%"
align="middle"
allowFullScreen="true"
allowScriptAccess="always"
scale="showall"
FlashVars="">-->
<!--播放flash 写法 end-->

<!--IE9及以上写法 begin-->
<video id="video" controls="controls">
<source id="videoSrc" src="路径.mp4" type="video/mp4" />
</video>
<!--IE9及以上写法 end-->
<!--IE8 播放MP4写法1 begin-->
<!--<embed id="flash" allowscriptaccess="sameDomain" allowNetworking="all" invokeurls="true" src="路径.mp4" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
quality="high" autostart="0" wmode="direct"
width="100%" height="100%"
align="middle"
allowFullScreen="true"
allowScriptAccess="always"
scale="showall"
FlashVars="">-->
<!--IE8 播放MP4写法1 end-->


<!--IE8 播放MP4写法2 begin-->
<p id="flash" style="text-align: center;display:none ">
<object id="MediaPlayer"
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="800"
height="600" standby="Loading Windows Media Player components…"
type="application/x-oleobject"
codebase=" style="color:#0000CC;">
<param name="FileName" value="路径.mp4">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="BufferingTime" value="2">
<param name="ShowStatusBar" value="true">
<param name="AutoSize" value="true">
<param name="InvokeURLs" value="false">
<param name="AnimationatStart" value="1">
<param name="TransparentatStart" value="1">
<param name="Loop" value="1">
<embed type="application/x-mplayer2" src="路径.mp4"
name="MediaPlayer" autostart="1" showstatusbar="1" showdisplay="1"
showcontrols="1" loop="0" videoborder3d="0"
pluginspage=""
width="800" height="600"></embed>
</object>
</p>
<!--IE8 播放MP4写法2 end-->
</div>
<script type="text/javascript">
$(function () {
//判断IE 版本1E8及以下调用flash ie9以上使用Video
checkIEVersion2();
});
function checkIEVersion2() {
var ieVersion = checkBrowerVersion2();
var height = document.documentElement.clientHeight - 185;
var src = "路径.mp4";
if (ieVersion == 'IE8.0') {
$("#video").hide();
var flash="";
flash += "<embed id='flash' style='width:100%;height:" + height + "px;' allowscriptaccess='sameDomain' allowNetworking='all' invokeurls='true' ";
flash += "src='" + src + "' ";
flash +="pluginspage='http://www.macromedia.com/go/getflashplayer' ";
flash +="type='application/x-shockwave-flash' ";
flash +="quality='high' autostart='0' wmode='direct' ";
flash +="width='100%' height='100%' ";
flash +="align='middle'";
flash +="allowFullScreen='true' ";
flash +="allowScriptAccess='always' ";
flash +="scale='showall' ";
flash +="FlashVars=''/> ";
$("#flash").html(flash);
$("#flash").show();
} else {
$("#video").attr("height", height+"px");
$("#videoSrc").attr("src", src + queryStr("path"));
}
//if (ieVersion.indexOf("IE") == -1) {
// //alert("请使用IE浏览器");
// //alertMessage(867);//请使用IE内核浏览器
// return false;
//}

//if (ieVersion == 'IE7.0') {
// //alert("请使用IE8及以上版本浏览器。");
// return false;
//}


}
function checkBrowerVersion2() {
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/rv:([\d.]+)\) like gecko/)) ? Sys.ie = s[1] :
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;

var version = "";
if (Sys.ie)
version = "IE" + Sys.ie;

if (Sys.firefox)
version = 'Firefox' + Sys.firefox;
if (Sys.chrome)
version = 'Chrome' + Sys.chrome;
if (Sys.opera)
version = 'Opera' + Sys.opera;
if (Sys.safari)
version = 'Safari' + Sys.safari;
return version;
}

</script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值