Browse Source

Restrict playing pip and video in viewer together

master
Eduard Kuzmenko 3 years ago
parent
commit
ed8d2eadc4
  1. 20
      src/components/appMediaPlaybackController.ts
  2. 2
      src/lib/mediaPlayer.ts

20
src/components/appMediaPlaybackController.ts

@ -859,6 +859,22 @@ export class AppMediaPlaybackController { @@ -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 { @@ -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();

2
src/lib/mediaPlayer.ts

@ -174,7 +174,7 @@ export default class VideoPlayer extends ControlsHover { @@ -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;
}

Loading…
Cancel
Save