From f1b3ceb3ae769b5d254851dcaba2b961058a4856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Mon, 13 Mar 2023 16:00:19 +0100 Subject: [PATCH] fix(Ads): Fix usage of EventManager on CS (#5084) --- lib/ads/client_side_ad_manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ads/client_side_ad_manager.js b/lib/ads/client_side_ad_manager.js index 10f2e63579..5cad73a5c1 100644 --- a/lib/ads/client_side_ad_manager.js +++ b/lib/ads/client_side_ad_manager.js @@ -219,9 +219,9 @@ shaka.ads.ClientSideAdManager = class { // seen the ads actually play until requestAds() is called. // Note: We listen for a play event to avoid autoplay issues that might // crash IMA. - this.video_.addEventListener('play', () => { + this.eventManager_.listenOnce(this.video_, 'play', () => { this.imaAdsManager_.start(); - }, {once: true}); + }); } catch (adError) { // If there was a problem with the VAST response, // we we won't be getting an ad. Hide ad UI if we showed it already