zoukankan      html  css  js  c++  java
  • 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

     

  • 相关阅读:
    GeoServer 2.2 正式版发布,GIS 服务器
    Spring Shell 1.0.0.RC1 发布
    微软发布支持Windows Desktop和F#的Visual Studio Express版本
    XINS 3.0 正式版发布,远程 API 调用规范
    YUI 3.7.2 补丁版发布
    HTML5 Boilerplate 4:改进了Apache配置和图片替换技术,并采用MIT许可证
    解决Windows Phone平台上不能枚举工程自带资源的问题
    截短 UTF8 字符串
    Spring Data Neo4j 2.1.0 RC4 发布
    GTK+ 3.5.18 发布,GUI 开发工具包
  • 原文地址:https://www.cnblogs.com/lyfblog/p/1957013.html
Copyright © 2011-2022 走看看