Skip to content

Commit

Permalink
fix(Ads): Fix CS destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed May 16, 2024
1 parent 4a41a9a commit 1b789ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions externs/ima.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ google.ima.AdDisplayContainer = class {
constructor(adContainer, video) {}

initialize() {}

destroy() {}
};


Expand Down
8 changes: 5 additions & 3 deletions lib/ads/client_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ shaka.ads.ClientSideAdManager = class {

google.ima.settings.setDisableCustomPlaybackForIOS10Plus(true);

const adDisplayContainer = new google.ima.AdDisplayContainer(
/** @private {!google.ima.AdDisplayContainer} */
this.adDisplayContainer_ = new google.ima.AdDisplayContainer(
this.adContainer_,
this.video_);

// TODO: IMA: Must be done as the result of a user action on mobile
adDisplayContainer.initialize();
this.adDisplayContainer_.initialize();

// IMA: This instance should be re-used for the entire lifecycle of
// the page.
this.adsLoader_ = new google.ima.AdsLoader(adDisplayContainer);
this.adsLoader_ = new google.ima.AdsLoader(this.adDisplayContainer_);

this.adsLoader_.getSettings().setPlayerType('shaka-player');
this.adsLoader_.getSettings().setPlayerVersion(shaka.Player.version);
Expand Down Expand Up @@ -176,6 +177,7 @@ shaka.ads.ClientSideAdManager = class {
this.imaAdsManager_.destroy();
}
this.adsLoader_.destroy();
this.adDisplayContainer_.destroy();
}

/**
Expand Down

0 comments on commit 1b789ec

Please sign in to comment.