我已经尝试了几次触发播放并结束下一个视频的事件,但它不再触发。在这里,在我的第一个视频中它触发播放,但是当它加载下一个视频时它不会触发任何事件。
在这里,我有代码。
https://codepen.io/hirakumar/pen/jKPbKJ
var iframe=document.getElementById('videoPlayer');
var player = new Vimeo.Player('videoPlayer');
var onPlay = function(data) {
console.log('Video is Played');
}
var onEnd = function(data) {
console.log('Video is ended');
}
this.player.on('play', onPlay);
this.player.on('ended', onEnd);
var nextBtn = document.querySelector('button#next');
var playNextVideo = function(event) {
console.log('Playing Next Video');
player.element.src = 'https://player.vimeo.com/video/234797489';
}
nextBtn.addEventListener('click', playNextVideo.bind(this));