diff --git a/src/components/appMediaPlaybackController.ts b/src/components/appMediaPlaybackController.ts index e2f55b5d..af6e19e1 100644 --- a/src/components/appMediaPlaybackController.ts +++ b/src/components/appMediaPlaybackController.ts @@ -859,6 +859,22 @@ export class AppMediaPlaybackController { const wasPlaying = this.pause(); + let onPlay: () => void; + if(media) { + onPlay = () => { + const pip = this.pip; + if(pip) { + pip.pause(); + } + }; + + if(!media.paused) { + onPlay(); + } + + media.addEventListener('play', onPlay); + } + this.willBePlayed(undefined); if(media) this.setMedia(media, message); else this.playingMedia = undefined; @@ -881,6 +897,10 @@ export class AppMediaPlaybackController { this.playingMediaType = undefined; } + if(media) { + media.removeEventListener('play', onPlay); + } + // I don't remember what it was for // if(media && this.playingMedia === media) { // this.stop(); diff --git a/src/lib/mediaPlayer.ts b/src/lib/mediaPlayer.ts index 46cc85bf..210d1884 100644 --- a/src/lib/mediaPlayer.ts +++ b/src/lib/mediaPlayer.ts @@ -174,7 +174,7 @@ export default class VideoPlayer extends ControlsHover { }); listenerSetter.add(document)('keydown', (e: KeyboardEvent) => { - if(rootScope.overlaysActive > 1 || document.pictureInPictureElement) { // forward popup is active, etc + if(rootScope.overlaysActive > 1 || document.pictureInPictureElement === video) { // forward popup is active, etc return; }