From 1b789ec7add0132e8bd2fd37267a70c6cfd441d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Thu, 16 May 2024 17:17:56 +0200 Subject: [PATCH] fix(Ads): Fix CS destroy --- externs/ima.js | 2 ++ lib/ads/client_side_ad_manager.js | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/externs/ima.js b/externs/ima.js index b23fb10bd3..bfdbab68f9 100644 --- a/externs/ima.js +++ b/externs/ima.js @@ -204,6 +204,8 @@ google.ima.AdDisplayContainer = class { constructor(adContainer, video) {} initialize() {} + + destroy() {} }; diff --git a/lib/ads/client_side_ad_manager.js b/lib/ads/client_side_ad_manager.js index 976e9b5675..7dbef48a73 100644 --- a/lib/ads/client_side_ad_manager.js +++ b/lib/ads/client_side_ad_manager.js @@ -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); @@ -176,6 +177,7 @@ shaka.ads.ClientSideAdManager = class { this.imaAdsManager_.destroy(); } this.adsLoader_.destroy(); + this.adDisplayContainer_.destroy(); } /**