做网站|网站建设,就上易助科技网

前端技术文档及相关资料下载

关于前端html、css、js等技术上的各种疑难棘手问题的解决方案探讨及相关资料下载!

JQuery Youtube视频播放器插件 YTPlayer.js
来源:易助科技网浏览量:4收藏

简介

YTPlayer.js一个开源jQuery组件,可轻松构建您的自定义Youtube播放器或使用Youtube视频作为页面的背景。

 


(下载的附件中附有DEMO)

注意事项:

1)该插件只有在web服务器下使用时才能工作。如果你将HTML页面作为文件运行(file://…),它就不起作用。如果你想在计算机上本地运行它,你需要安装一个web服务器(例如:MAMP for Mac,XAMP for Windows,LAMP for linux),然后从http://localhost…或您在Host文件中映射为localhost的任何内容。

2)该插件不适用于jquery.slim.js,因为它需要从精简版jquery中删除的方法。


简单使用

1.  引入文件

<link href="css/jquery.mb.YTPlayer.min.css" media="all" rel="stylesheet" type="text/css">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="inc/jquery.mb.YTPlayer.js"></script>


2.  HTML

<div id="bgndVideo" class="player" data-property="{videoURL:'http://youtu.be/BsekcY04xvQ',containment:'body',autoPlay:true, mute:true, startAt:0, opacity:1}">My video</div>


3.  调用

jQuery(function(){
jQuery("#[playerID]").YTPlayer();
});


相关链接

官方文档(英文):https://github.com/pupunzi/jquery.mb.YTPlayer/wiki

GitHub 地址:https://github.com/pupunzi/jquery.mb.YTPlayer/wiki