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) {