分享一款基于jQuery的视频播放插件

2019/6/29 22:35:12

本文主要是介绍分享一款基于jQuery的视频播放插件,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

最近写了一个在线视频播放的功能,感觉这个插件还可以,和大家分享一下!

复制代码 代码如下:

<div class="report" id="play-product" style="cursor: pointer"  data-flv="视频路径地址"></div>

<script type="text/javascript">
//播放视频
$('#play-product').click(function(){
      var flvUrl = $(this).attr('data-flv');
      var Close = 'closePlayer';
      var box = 'playerBox';

      var objclose = "#"+Close;
      var objBox = "#"+box;

      $("body").append("<div id= "+box+"><div class='closeTitle'><a href='javascript:;' id= "+Close+">点击关闭</a></div><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='100%' height='100%' id='index' align='middle'><param name='movie' value='/club/images/flvPlayer.swf'><param name='quality' value='high'><param name='bgcolor' value='#000'><param name='play' value='true'><param name='loop' value='true'><param name='wmode' value='transparent'><param name='scale' value='showall'><param name='menu' value='true'><param name='devicefont' value='false'><param name='salign' value=''><param name='flashvars'  value='flvURL="+flvUrl+"'><param name='allowScriptAccess' value='sameDomain'><param name='allowFullScreen' value='true'><!--[if !IE]>--><object type='application/x-shockwave-flash' data='/club/images/flvPlayer.swf' width='100%' height='100%' align='middle'><param name='movie' value='/club/images/flvPlayer.swf'><param name='quality' value='high'><param name='bgcolor' value='#000'><param name='play' value='true'><param name='loop' value='true'><param name='wmode' value='transparent'><param name='scale' value='showall'><param name='menu' value='true'><param name='devicefont' value='false'><param name='salign' value=''><param name='allowFullScreen' value='true'><param name='flashvars' value='flvURL="+flvUrl+"'><param name='allowScriptAccess' value='sameDomain'><!--<![endif]--><a href='http://www.adobe.com/go/getflash'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='取得 Adobe Flash 播放程式'></a><!--[if !IE]>--></object><!--<![endif]--></object></div>");

        $(objclose).click(function(){
          $(objBox).remove();
        });
        return false;
    });
</script>



这篇关于分享一款基于jQuery的视频播放插件的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程