Skip to content

Commit 9fd5900

Browse files
authored
fix(Ads): Fix overlay interstitial when the seeked is outside of the current window (#8288)
1 parent 78a16d9 commit 9fd5900

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/ads/interstitial_ad_manager.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,18 @@ shaka.ads.InterstitialAdManager = class {
988988
} else if (interstitial.endTime) {
989989
this.playoutLimitTimer_.tickEvery(/* seconds= */ 0.025);
990990
}
991+
this.adEventManager_.listen(this.baseVideo_, 'seeked', () => {
992+
const currentTime = this.baseVideo_.currentTime;
993+
if (currentTime < interstitial.startTime ||
994+
(interstitial.endTime && currentTime > interstitial.endTime)) {
995+
if (this.playoutLimitTimer_) {
996+
this.playoutLimitTimer_.stop();
997+
}
998+
this.onEvent_(
999+
new shaka.util.FakeEvent(shaka.ads.Utils.AD_SKIPPED));
1000+
basicTask();
1001+
}
1002+
});
9911003
}
9921004

9931005

@@ -1287,6 +1299,13 @@ shaka.ads.InterstitialAdManager = class {
12871299
this.video_.currentTime = newPosition;
12881300
}
12891301
});
1302+
this.adEventManager_.listen(this.baseVideo_, 'seeked', () => {
1303+
const currentTime = this.baseVideo_.currentTime;
1304+
if (currentTime < interstitial.startTime ||
1305+
(interstitial.endTime && currentTime > interstitial.endTime)) {
1306+
this.lastOnSkip_();
1307+
}
1308+
});
12901309
}
12911310
} catch (e) {
12921311
if (!this.playingAd_) {

0 commit comments

Comments
 (0)