我正在使用Wistia进行视频托管,并使用wistia播放器在我的网站上播放视频。我需要检测视频播放器事件,例如“暂停”和“结束”,并根据某些标准播放另一个视频。
以下代码会更改视频暂停时播放的视频。此代码适用于Chrome和Safari。但在Firefox(Ver 29)中,视频通过Flash插件播放,并且不会生成“暂停”,“结束”等视频播放器事件。
<script>
var firstVideoId = "993554ba94",
var secondVideoId = "9dc0dc7d3a";
firstVideo = Wistia.embed( firstVideoId , {
container: "video_container",
playerPreference: "html5"
});
firstVideo.bind('pause',function(){
// Play next video.
changeVideo();
});
firstVideo.play();
function changeVideo() {
// Remove first video and play the second.
firstVideo.remove();
secondVideo = Wistia.embed( secondVideoId , {
container: "video_container",
playerPreference: "html5",
autoPlay: true
});
secondVideo.bind('pause',function() {
changeBack();
});
}
function changeBack() {
// Remove second video and play the first
secondVideo.remove();
firstVideo = Wistia.embed( firstVideoId , {
container: "video_container",
playerPreference: "html5",
autoPlay: true
});
firstVideo.bind('pause',function() {
changeVideo();
});
firstVideo.play();
}
</script>
以下是我的问题: