我正在尝试从Vimeo等外部来源循环播放视频。当视频结束为Vimeo播放时,我已成功捕获了该事件。
但是,我怎么能一个接一个地遍历multiple videos
。
下面是我的代码,它捕获单个视频的完成事件。任何帮助,将不胜感激。感谢。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
<script src="jquery-1.11.1.min.js"></script>
<script src="froogaloop.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var iframe = $('#player1')[0],
player = $f(iframe),
status = $('.status');
// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
status.text('ready');
player.addEvent('pause', onPause);
player.addEvent('finish', onFinish);
player.addEvent('playProgress', onPlayProgress);
});
// Call the API when a button is pressed
$('button').bind('click', function() {
player.api($(this).text().toLowerCase());
});
function onPause(id) {
status.text('paused');
}
function onFinish(id) {
status.text('finished');
}
function onPlayProgress(data, id) {
status.text(data.seconds + 's played');
}
});
</script>
</head>
<body>
<section>
<article>
<iframe id="player1" src="http://player.vimeo.com/video/470742?api=1&player_id=player1&autoplay=1" width="400" height="225" frameborder="0"></iframe>
<p>Video status: <span class="status">...</span></p>
<p><button>Play</button> <button>Pause</button></p>
</article>
</section>
</body>
</html>
答案 0 :(得分:1)
用这个改变你的onFinish功能
function onFinish(id) {
status.text('finished');
$("#player1").attr("src","new video url here")
}