From 6357c16d72116a0436ebb80dcc7edb9985d530b6 Mon Sep 17 00:00:00 2001 From: Rob Walch Date: Tue, 10 Dec 2024 15:52:20 -0800 Subject: [PATCH] Don't resume playback on interstitial transition after player is paused --- src/controller/interstitials-controller.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controller/interstitials-controller.ts b/src/controller/interstitials-controller.ts index b3b94717746..c1679eccd8c 100644 --- a/src/controller/interstitials-controller.ts +++ b/src/controller/interstitials-controller.ts @@ -218,7 +218,7 @@ export default class InterstitialsController // @ts-ignore this.assetListLoader = null; // @ts-ignore - this.onPlay = this.onSeeking = this.onTimeupdate = null; + this.onPlay = this.onPause = this.onSeeking = this.onTimeupdate = null; // @ts-ignore this.onScheduleUpdate = null; } @@ -232,6 +232,7 @@ export default class InterstitialsController private removeMediaListeners(media: HTMLMediaElement) { media.removeEventListener('play', this.onPlay); + media.removeEventListener('pause', this.onPause); media.removeEventListener('seeking', this.onSeeking); media.removeEventListener('timeupdate', this.onTimeupdate); } @@ -245,6 +246,7 @@ export default class InterstitialsController media.addEventListener('seeking', this.onSeeking); media.addEventListener('timeupdate', this.onTimeupdate); media.addEventListener('play', this.onPlay); + media.addEventListener('pause', this.onPause); } private onMediaAttached( @@ -763,6 +765,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`, this.shouldPlay = true; }; + private onPause = () => { + this.shouldPlay = false; + }; + private onSeeking = () => { const currentTime = this.currentTime; if (currentTime === undefined || this.playbackDisabled) {