您的位置:首页 > 其它

优酷视频控制

2016-07-23 21:53 190 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>js控制优酷视频播放</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://player.youku.com/jsapi"></script>
<script>
player = new YKU.Player('youkuplayer',{
styleid: '0',
client_id: 'd8781b239fdad45b',
vid: 'XMjg1MTcyNDQ0',
autoplay: false,
show_related: true,
events:{
onPlayEnd: function(){ },
onPlayStart: function(){ },
onPlayerReady: function(){ }
}
});
function playVideo(){
try{
player.playVideo();
} catch(err){
alert("*"+err);
}
}
function pauseVideo(){
player.pauseVideo();
}
function seekTo(s){
player.seekTo(s);
}
function currentTime(){
return player.currentTime();
}
</script>
</head>
<body>
<div id="youkuplayer" style="width:100%;height:400px;"></div>
<br />
<input type="button" onclick="playVideo();" value="播放" style="height:30px;width:50px;">
<input type="button" onclick="pauseVideo();" value="暂停" style="height:30px;width:50px;">
</body>
</html>
查看API请移步:http://doc.open.youku.com/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: