Skip to content

Commit ace6cb7

Browse files
authored
fix(Ads): Destroy preloadManagers on stop interstitials (#8268)
1 parent b5bb585 commit ace6cb7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/ads/interstitial_ad_manager.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,18 @@ shaka.ads.InterstitialAdManager = class {
329329
this.interstitialIds_.clear();
330330
this.interstitials_.clear();
331331
this.player_.destroyAllPreloads();
332+
if (this.preloadManagerInterstitials_.size) {
333+
const values = Array.from(this.preloadManagerInterstitials_.values());
334+
for (const value of values) {
335+
if (value) {
336+
value.then((preloadManager) => {
337+
if (preloadManager) {
338+
preloadManager.destroy();
339+
}
340+
});
341+
}
342+
};
343+
}
332344
this.preloadManagerInterstitials_.clear();
333345
this.player_.detach();
334346
this.playingAd_ = false;

0 commit comments

Comments
 (0)