让燕子飞的博客

导航

flv视频播放器flvplayer.swf使用

今天由于网页上要加入一个视频文件,就研究了一下flv视频播放器flvplayer.swf

一、直接在html文件中加载:

<div id="FlashFile">
<object type="application/x-shockwave-flash" width="470px" height="403px"
    data="flvplayer.swf?file=movies/company.flv">
<param name="movie" value="flvplayer.swf?file=movies/company.flv&showfsbutton=true&autostart=true" />
<param name="wmode" value="transparent" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
</object>
        </div>

二、使用javascript动态加载:

<script type="text/javascript">
    function PlayFlv(filename) {
        var videoname = filename; //视频文件名
        var floder = "video"; //存放Flash视频的文件夹,注意是相对flvplayer.swf文件的位置(images/flvplayer.swf)
        var div = document.getElementById("flvPlayDiv");
        div.innerHTML = "<img src='images/wait.gif' alt=''>"; //增加等待图片已增加用户体验;
        div.style.display = "none";
        var result = "<table align='center'><tr><td align='center'><object type='application/x-shockwave-flash' width='470px' height='403px' ";
        result += "data='images/flvplayer.swf?file=" + floder + "/" + filename + "'>";
        result += "<param name='movie' value='images/flvplayer.swf?file=" + floder + "/" + filename + "&showfsbutton=true&autostart=true' />";
        result += "<param name='wmode' value='transparent' />";
        result += "<param name='quality' value='high' />";
        result += "<param name='allowfullscreen' value='true' />";
        result += "</object></td></tr></table> ";
        div.innerHTML = result;
        div.style.display = "inline";//div显示方式
    }
</script>
 

 在body区域中加入以下代码:

 <button id="kk" type="button" onclick="PlayFlv('company1.flv')">播放1</button>
 <br /><button id="k2" type="button" onclick="PlayFlv('company2.flv')">播放2</button>
    <div id="flvPlayDiv"></div>
<!--视频播放的div区域 -->

 参考:http://cnidc.blog.hexun.com/23076403_d.html

 

posted on 2011-02-17 18:02  让燕子飞  阅读(4108)  评论(1编辑  收藏  举报