Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Cleaning up play/pause events
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sinchok committed Nov 6, 2014
1 parent f370096 commit a4c94c4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions videojs.vast.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,11 @@
}
player.vastTracker.setProgress(player.currentTime());
},
playFn = function() {
if (player.ads.state === 'ad-playback') {
player.vastTracker.setPaused(false);
}
},
pauseFn = function() {
player.vastTracker.setPaused(true);
player.one('play', function(){
player.vastTracker.setPaused(false);
});
},
errorFn = function() {
// Inform ad server we couldn't play the media file for this ad
Expand All @@ -152,14 +150,12 @@

player.on('canplay', canplayFn);
player.on('timeupdate', timeupdateFn);
player.on('play', playFn);
player.on('pause', pauseFn);
player.on('error', errorFn);

player.one('ended', function() {
player.one('vast-preroll-removed', function() {
player.off('canplay', canplayFn);
player.off('timeupdate', timeupdateFn);
player.off('play', playFn);
player.off('pause', pauseFn);
player.off('error', errorFn);
if (!errorOccurred) {
Expand Down

0 comments on commit a4c94c4

Please sign in to comment.