зеркало из https://github.com/GoogleChrome/kino.git
Only play one video in PiP at once.
This commit is contained in:
Родитель
cd26b29d6c
Коммит
f451221edc
|
@ -27,7 +27,7 @@ import {
|
|||
PIP_CLASSNAME,
|
||||
} from '../../constants';
|
||||
|
||||
export default class extends HTMLElement {
|
||||
export default class VideoPlayer extends HTMLElement {
|
||||
/**
|
||||
* @param {VideoDownloader} downloader Video downloader associated with the current video.
|
||||
*/
|
||||
|
@ -464,6 +464,11 @@ export default class extends HTMLElement {
|
|||
pipButton.disabled = true;
|
||||
try {
|
||||
if (this !== document.pictureInPictureElement) {
|
||||
// If another video is already in PiP, pause it and exit PiP mode.
|
||||
if (document.pictureInPictureElement instanceof VideoPlayer) {
|
||||
document.pictureInPictureElement.videoElement.pause();
|
||||
await document.exitPictureInPicture();
|
||||
}
|
||||
await this.videoElement.requestPictureInPicture();
|
||||
} else {
|
||||
await document.exitPictureInPicture();
|
||||
|
|
Загрузка…
Ссылка в новой задаче