Skip to content

Commit

Permalink
fix(FEC-7515): fix wrong resume event when ad preroll is set (kaltura…
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenMe authored Nov 22, 2017
1 parent db69259 commit fc56172
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions modules/KalturaSupport/resources/mw.kAnalony.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,33 @@
} );

this.embedPlayer.bindHelper('onPlayerStateChange', function(e, newState, oldState) {
if (newState === "pause" ){
_this.stopViewTracking();
}
if (newState === "play"){
if ( oldState === "start" || oldState === "pause" ){
_this.startViewTracking();
}
}
if (!this.isInSequence()) {
if (newState === "pause") {
_this.stopViewTracking();
}
if (newState === "play") {
if (oldState === "start" || oldState === "pause") {
_this.startViewTracking();
}
}
}
});

this.embedPlayer.bindHelper( 'AdSupport_midroll AdSupport_postroll' , function () {
_this.savedPosition = _this.embedPlayer.currentTime; // during ad playback (mid and post only), report position as the last player position
});

this.embedPlayer.bindHelper( 'AdSupport_EndAdPlayback' , function () {
setTimeout(function(){
_this.savedPosition = null; // use timeout to use the savedPosition for events reported immediately after ad finish (play event)
},0);
_this.startViewTracking();
});

this.embedPlayer.bindHelper('AdSupport_StartAdPlayback', function() {
_this.stopViewTracking();
});

// events for capturing the bitrate of the currently playing source
this.embedPlayer.bindHelper( 'SourceSelected' , function (e, source) {
if (source.getBitrate()){
Expand All @@ -256,17 +273,6 @@
_this.currentBitRate = newSource.newBitrate;
}
});

this.embedPlayer.bindHelper( 'AdSupport_midroll AdSupport_postroll' , function () {
_this.savedPosition = _this.embedPlayer.currentTime; // during ad playback (mid and post only), report position as the last player position
});

this.embedPlayer.bindHelper( 'AdSupport_EndAdPlayback' , function () {
setTimeout(function(){
_this.savedPosition = null; // use timeout to use the savedPosition for events reported immediately after ad finish (play event)
},0);

});
},
resetPlayerflags:function(){
this._p25Once = false;
Expand Down

0 comments on commit fc56172

Please sign in to comment.