javascript - 当玩家到达某个视频点时,Ooyala播放器事件通知

  显示原文与译文双语对照的内容
0 0

我深入了解了 Ooyala of API,搜索当当前播放的视频时触发的事件,比如 75% 。

Ooyala提供了一种方法来查询一些视频的0%,25%,50%,75%和mb视图,但是我找不到方法。

我已经检查了所有的 http://support.ooyala.com/developers/documentation/concepts/book_api_player.html 。

以前有谁通过过这个? 你知道有什么aother来源可以帮助你?

先谢谢了。

时间: 原作者:

0 0
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!');
 }

将给你视频的总时间。phPos 将给你当前的播放时间。

你应该能够做数学,并且让视频触发一个动作一旦达到一定百分比。 在我的示例中,当视频达到 90秒时,我将设置一个警报设置。

原作者:
0 0
I think this will work
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() {
 if((videoPlayer.getPlayheadTime())>= (videoPlayer.getDuration()*0.25)){ 
 alert('play 25%') 
 }
 if((videoPlayer.getPlayheadTime())>= (videoPlayer.getDuration()*0.50)){ 
 alert('play 50%') 
 }
 if((videoPlayer.getPlayheadTime())>= (videoPlayer.getDuration()*0.75)){ 
 alert('play 75%') 
 }
 if((videoPlayer.getPlayheadTime())>= (videoPlayer.getDuration()*1.00)){ 
 alert('play 100%') 
 }
}
原作者:
...