FLV播放器无法在IE浏览器中运行?

时间:2011-11-04 05:37:18

标签: html internet-explorer firefox google-chrome swfobject

我有以下代码播放flv文件,

<embed align="middle" width="185" height="121" 
    pluginspage="http://www.macromedia.com/go/getflashplayer" 
    type="application/x-shockwave-flash" allowfullscreen="true"
    allowscriptaccess="sameDomain"
    name="vidplayer" bgcolor="#eae7db" quality="high" f
    lashvars="file=<?= $vUrl; ?>" src="scripts/flvplayer.swf" />

以上代码仅适用于FF,Chrome不在IE浏览器中。

我还提到链接How to embed a SWF file in an HTML page?已更改上面的代码,如下所示

<object width="185" height="121">
    <param name="movie" value="<?php echo BASE_URL; ?>scripts/flvplayer.swf">
    <embed align="middle" width="185" height="121"
        pluginspage="http://www.macromedia.com/go/getflashplayer" 
        type="application/x-shockwave-flash" allowfullscreen="true" 
        allowscriptaccess="sameDomain" name="vidplayer" bgcolor="#eae7db"
        quality="high" flashvars="file=<?= $vUrl; ?>"
        src="scripts/flvplayer.swf" >
    </embed>
</object>

以上代码仅适用于FF而不适用于Chrome和IE。

如何在所有浏览器中播放我的flv文件?

1 个答案:

答案 0 :(得分:1)

试试这种方式。

 <script type="text/javascript">        
       var flashvars = {};
       var params = {};
       var attributes = {};     
       flashvars.mp3="mast.mp3";
       var so = new swfobject.embedSWF("player.swf", "myContent", "300", "120", "9.0.0",true, flashvars, params, attributes);
       so.write("myContent");
    </script>

并查看此Documentation