Skip to content

Commit

Permalink
fix: Add nopostroll trigger. (#585)
Browse files Browse the repository at this point in the history
* fix: Add nopostroll trigger.

* Added semicolon.
  • Loading branch information
shawnbuso committed Mar 29, 2018
1 parent b580e21 commit e790e6d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,14 @@ Controller.prototype.onContentComplete = function() {
this.sdkImpl.onContentComplete();
};

/**
* Called by the player wrapper when it's time to play a post-roll but we don't
* have one to play.
*/
Controller.prototype.onNoPostroll = function() {
this.playerWrapper.onNoPostroll();
};

/**
* Called when content and all ads have completed.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/player-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ PlayerWrapper.prototype.localContentEndedListener = function() {
}
};

/**
* Called when it's time to play a post-roll but we don't have one to play.
*/
PlayerWrapper.prototype.onNoPostroll = function() {
this.vjsPlayer.trigger('nopostroll');
};

/**
* Detects when the video.js player has been disposed.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/sdk-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,12 @@ SdkImpl.prototype.onContentComplete = function() {
this.contentCompleteCalled = true;
}

if (this.adsManager &&
this.adsManager.getCuePoints() &&
!this.adsManager.getCuePoints().includes(-1)) {
this.controller.onNoPostroll();
}

if (this.allAdsCompleted) {
this.controller.onContentAndAdsCompleted();
}
Expand Down

0 comments on commit e790e6d

Please sign in to comment.