有人能告诉我我的代码有什么问题吗?
我想要一个具有切换(选中/取消选中)的功能来播放视频播放列表。
我的意思是" youtube或Lynda.com"有这两个网站播放播放列表,如果用户不喜欢视频播放,他们可以关闭切换到自动播放章节。
我写了一些代码,当初始视频结束时它应该播放下一个视频,但它不起作用。
<!DOCTYPE html>
<html lang="en">
<head>test</head>
<body>
<p>test script<p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="https://player.vimeo.com/api/player.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.cookie/1.4.0/jquery.cookie.min.js"></script>
<p><input type="Checkbox" id="autoplay" onclick="check()" value="1" />Autoplay</p>
<div id="vimeo">
<iframe id="player" width="590" height="360" src="http://player.vimeo.com/video/218543813?api=1&player_id=player" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>
<script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>
<script>
$('#autoplay').click(function(){
if (this.checked) {
var player = $f(document.getElementById('player'));
player.addEvent('ready', function() {
player.api('play');
});
var iframe = $('#vimeo iframe')[0],
player = $f(iframe);
// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
player.addEvent('finish', onFinish);
});
function onFinish(id) {
window.location.href = 'https://vimeo.com/channels/staffpicks/218543813';
}
})
</script>
</body>
</html>