zoukankan      html  css  js  c++  java
  • 适配IE8+等浏览器的适配播放插件

    function myBrowser(){
    var userAgent = navigator.userAgent; //ȡ���������userAgent�ַ�
    var isOpera = userAgent.indexOf("Opera") > -1;
    if (isOpera) {
    return "Opera"
    } //�ж��Ƿ�Opera�����
    if (userAgent.indexOf("Android") > -1||userAgent.indexOf("iPhone") > -1||userAgent.indexOf("iPad") > -1){
    return "Mobile";
    }
    if (userAgent.indexOf("Firefox") > -1) {
    return "FF";
    } //�ж��Ƿ�Firefox�����
    if (userAgent.indexOf("Chrome") > -1){
    return "Chrome";
    }
    if (userAgent.indexOf("Safari") > -1) {
    return "Safari";
    } //�ж��Ƿ�Safari�����
    if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
    return "IE";
    } //�ж��Ƿ�IE�����
    }
    function showVedio(url,coverurl,w,h,isAuto){
    if(isAuto==null)
    {
    isAuto=false;
    }
    var b = myBrowser();var str;
    if(b=="Safari"||b=="FF"||b=="Opera"||b=="Mobile")
    {
    str='<video width="'+w+'" height="'+h+'" controls poster="'+coverurl+'"><source src="'+url+'" type="video/mp4"/></video>'
    }
    else
    {
    str='<object id="vcastr3" data="js/vcastr/Flvplayer.swf" height="'+h+'px" width="'+w+'px" type="application/x-shockwave-flash">';
    str+='<param name="movie" value="js/vcastr/Flvplayer.swf"><param value="transparent" name="wmode">';
    str+='<param name="allowFullScreen" value="true">';
    str+='<param name="FlashVars" value="xml=<vcastr><channel><item><source>'+url+'</source><image>'+coverurl+'</image></item></channel><config><isAutoPlay>true</isAutoPlay><isLoadBegin>'+isAuto+'</isLoadBegin><isShowAbout>false</isShowAbout><scaleMode>showAll</scaleMode></config>' +
    '<plugIns><beginEndImagePlugIn><url>js/vcastr/beginEndImagePlugIn.swf</url><source>'+coverurl+'</source><type>begin</type><scaleType>exactFit</scaleType></beginEndImagePlugIn></plugIns></vcastr>"></object>';
    //'<logoPlugIn><url>js/vcastr/logoPlugIn.swf</url><logoText>www.meowpet.com</logoText><logoTextAlpha>0.75</logoTextAlpha><logoTextFontSize>20</logoTextFontSize><logoTextLink>www.meowpet.com</logoTextLink><logoTextColor>0xffffff</logoTextColor><textMargin>20 20 auto auto</textMargin></logoPlugIn>">';
    str+='';
    }
    document.write(str);
    }

    使用方法:

    <script type="text/javascript">

        showVedio("视频地址","视频封面图片",,);

    </script>

  • 相关阅读:
    课程总结第十一周
    用户场景分析
    团队冲刺10
    课程总结第十周
    团队冲刺09
    梦断代码阅读笔记03
    转发和重定向的区别
    request
    servletConfig
    servlet
  • 原文地址:https://www.cnblogs.com/davidpan/p/5643871.html
Copyright © 2011-2022 走看看