var videoPlayer = OO.Player.create('Player', embedcode, {
autoplay: true,
onCreate: function (player) {
mesb = player.mb;
}
});
mesb.subscribe(OO.EVENTS.PLAYBACK_READY, 'example', _.bind(this.videoPlaying, this));
mesb.subscribe(OO.EVENTS.PLAYHEAD_TIME_CHANGED, 'example', _.bind(this.playheadTime, this));
function videoPlaying() {
var title, desc, embed, dur;
var vData = videoPlayer.getItem();
dur = vData.time;
}
function playheadTime() {
phPos = videoPlayer.getPlayheadTime();
if (phPos > 90) {
alert('you are 90 seconds in to the video!');
}
dur会给你视频的总时间。
phPos会给你当前的播放头时间。
您应该能够进行数学运算,并在达到一定百分比后让视频触发动作。在我的示例中,当视频达到 90 秒时,我设置了一个警报。