Restrict playing pip and video in viewer together

This commit is contained in:
Eduard Kuzmenko 2022-04-17 14:25:37 +03:00
parent cd338e0596
commit ed8d2eadc4
2 changed files with 21 additions and 1 deletions

View File

@ -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();

View File

@ -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;
}