Skip to content

Commit

Permalink
fix(FEC-10694): Ima post roll overrides the post bumper (#378)
Browse files Browse the repository at this point in the history
Issue: the post bumper overridden by the post roll.
Solution: should wait to onPromiseEnded of bumper resolved and then call ima onPromiseEnded.
  • Loading branch information
Yuvalke committed Nov 25, 2020
1 parent 22659f9 commit e350cbe
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/common/controllers/ads-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,18 +324,17 @@ class AdsController extends FakeEventTarget implements IAdsController {
}
const bumperCtrl = this._adsPluginControllers.find(controller => this._isBumper(controller));
const adCtrl = this._adsPluginControllers.find(controller => !this._isBumper(controller));
const bumperCompletePromise = bumperCtrl && typeof bumperCtrl.onPlaybackEnded === 'function' ? bumperCtrl.onPlaybackEnded() : Promise.resolve();
const adCompletePromise = adCtrl && typeof adCtrl.onPlaybackEnded === 'function' ? adCtrl.onPlaybackEnded() : Promise.resolve();
const bumperCompleted =
bumperCtrl && typeof bumperCtrl.onPlaybackEnded === 'function' ? () => bumperCtrl.onPlaybackEnded() : () => Promise.resolve();
const adCompleted = adCtrl && typeof adCtrl.onPlaybackEnded === 'function' ? () => adCtrl.onPlaybackEnded() : () => Promise.resolve();
if (!(this._adBreaksLayout.includes(-1) || this._adBreaksLayout.includes('100%'))) {
this._allAdsCompleted = true;
} else {
const playbackEndedHandler = () => this._handleConfiguredPostroll();
// $FlowFixMe
bumperCompletePromise.finally(() => {
// $FlowFixMe
adCompletePromise.finally(playbackEndedHandler);
});
}
// $FlowFixMe
bumperCompleted().finally(() => {
// $FlowFixMe
adCompleted().finally(() => this._handleConfiguredPostroll());
});
}

_onPlaybackEnded(): void {
Expand Down

0 comments on commit e350cbe

Please sign in to comment.