mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Merge pull request #2194 from EscherMoore/fix-pip
Fix: Keep Picture-in-Picture open when switching videos
This commit is contained in:
commit
ca6c76384b
1 changed files with 5 additions and 2 deletions
|
@ -370,6 +370,9 @@ export default {
|
||||||
else this.setPlayerAttrs(this.$player, videoEl, uri, mime, this.$shaka);
|
else this.setPlayerAttrs(this.$player, videoEl, uri, mime, this.$shaka);
|
||||||
|
|
||||||
if (noPrevPlayer) {
|
if (noPrevPlayer) {
|
||||||
|
videoEl.addEventListener("loadeddata", () => {
|
||||||
|
if (document.pictureInPictureElement) videoEl.requestPictureInPicture();
|
||||||
|
});
|
||||||
videoEl.addEventListener("timeupdate", () => {
|
videoEl.addEventListener("timeupdate", () => {
|
||||||
const time = videoEl.currentTime;
|
const time = videoEl.currentTime;
|
||||||
this.$emit("timeupdate", time);
|
this.$emit("timeupdate", time);
|
||||||
|
@ -686,14 +689,14 @@ export default {
|
||||||
if (markers) markers.style.background = `linear-gradient(${array.join(",")})`;
|
if (markers) markers.style.background = `linear-gradient(${array.join(",")})`;
|
||||||
},
|
},
|
||||||
destroy(hotkeys) {
|
destroy(hotkeys) {
|
||||||
if (this.$ui) {
|
if (this.$ui && !document.pictureInPictureElement) {
|
||||||
this.$ui.destroy();
|
this.$ui.destroy();
|
||||||
this.$ui = undefined;
|
this.$ui = undefined;
|
||||||
this.$player = undefined;
|
this.$player = undefined;
|
||||||
}
|
}
|
||||||
if (this.$player) {
|
if (this.$player) {
|
||||||
this.$player.destroy();
|
this.$player.destroy();
|
||||||
this.$player = undefined;
|
if (!document.pictureInPictureElement) this.$player = undefined;
|
||||||
}
|
}
|
||||||
if (hotkeys) this.$hotkeys?.unbind();
|
if (hotkeys) this.$hotkeys?.unbind();
|
||||||
this.$refs.container?.querySelectorAll("div").forEach(node => node.remove());
|
this.$refs.container?.querySelectorAll("div").forEach(node => node.remove());
|
||||||
|
|
Loading…
Reference in a new issue