Skip to content

Commit

Permalink
fix(FEC-11062): ad layout doesn't work when IMA DAI configured (#425)
Browse files Browse the repository at this point in the history
Issue: play ad now to use the active plugin with play ad now API.
Solution: instead of empty implementation on ad plugins, implement it only where it's needed, and check if there's a plugin with this API available to play the ad.
  • Loading branch information
Yuvalke authored Mar 8, 2021
1 parent edc1fee commit 2251d5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flow-typed/interfaces/ads-plugin-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare interface IAdsPluginController {
skipAd(): void;
playAdNow(adPod: KPAdPod): void;
playAdNow?: (adPod: KPAdPod) => void;
onPlaybackEnded(): Promise<void>;
+active: boolean;
+done: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/common/controllers/ads-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@ class AdsController extends FakeEventTarget implements IAdsController {
}

_playAdBreak(adBreak: RunTimeAdBreakObject): void {
const adController = this._adsPluginControllers.find(controller => !this._isBumper(controller));
const adController = this._adsPluginControllers.find(controller => typeof controller.playAdNow === 'function');
if (adController) {
adBreak.played = true;
this._adIsLoading = true;
AdsController._logger.debug(`Playing ad break positioned in ${adBreak.position}`);
// $FlowFixMe
adController.playAdNow(adBreak.ads);
} else {
AdsController._logger.warn('No ads plugin registered');
Expand Down

0 comments on commit 2251d5f

Please sign in to comment.