mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 02:25:08 +01:00
Webkit support
This commit is contained in:
parent
f2f7925cbb
commit
3fad6edaad
@ -54,8 +54,3 @@ body[data-no-select] {
|
|||||||
.google-cast-button:not(.casting) google-cast-launcher {
|
.google-cast-button:not(.casting) google-cast-launcher {
|
||||||
@apply brightness-[500];
|
@apply brightness-[500];
|
||||||
}
|
}
|
||||||
|
|
||||||
:picture-in-picture {
|
|
||||||
opacity: 0.3;
|
|
||||||
filter: blur(5px);
|
|
||||||
}
|
|
||||||
|
@ -42,3 +42,7 @@ export function canFullscreen(): boolean {
|
|||||||
export function canPictureInPicture(): boolean {
|
export function canPictureInPicture(): boolean {
|
||||||
return "pictureInPictureEnabled" in document;
|
return "pictureInPictureEnabled" in document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function canWebkitPictureInPicture(): boolean {
|
||||||
|
return "webkitSupportsPresentationMode" in document.createElement("video");
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
canFullscreenAnyElement,
|
canFullscreenAnyElement,
|
||||||
canWebkitFullscreen,
|
canWebkitFullscreen,
|
||||||
canPictureInPicture,
|
canPictureInPicture,
|
||||||
|
canWebkitPictureInPicture,
|
||||||
} from "@/utils/detectFeatures";
|
} from "@/utils/detectFeatures";
|
||||||
import { MWStreamType } from "@/backend/helpers/streams";
|
import { MWStreamType } from "@/backend/helpers/streams";
|
||||||
import { updateInterface } from "@/video/state/logic/interface";
|
import { updateInterface } from "@/video/state/logic/interface";
|
||||||
@ -205,19 +206,28 @@ export function createVideoStateProvider(
|
|||||||
updateSource(descriptor, state);
|
updateSource(descriptor, state);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async togglePictureInPicture() {
|
togglePictureInPicture() {
|
||||||
if (!canPictureInPicture()) return;
|
if (canWebkitPictureInPicture()) {
|
||||||
|
const webkitPlayer = player as any;
|
||||||
|
webkitPlayer.webkitSetPresentationMode(
|
||||||
|
webkitPlayer.webkitPresentationMode === "picture-in-picture"
|
||||||
|
? "inline"
|
||||||
|
: "picture-in-picture"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (canPictureInPicture()) {
|
||||||
if (player !== document.pictureInPictureElement) {
|
if (player !== document.pictureInPictureElement) {
|
||||||
try {
|
try {
|
||||||
await player.requestPictureInPicture();
|
player.requestPictureInPicture();
|
||||||
} catch {
|
} catch {
|
||||||
state.interface.isPictureInPicture = false;
|
state.interface.isPictureInPicture = false;
|
||||||
}
|
}
|
||||||
state.interface.isPictureInPicture = true;
|
state.interface.isPictureInPicture = true;
|
||||||
} else {
|
} else {
|
||||||
await document.exitPictureInPicture();
|
document.exitPictureInPicture();
|
||||||
state.interface.isPictureInPicture = false;
|
state.interface.isPictureInPicture = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
providerStart() {
|
providerStart() {
|
||||||
this.setVolume(getStoredVolume());
|
this.setVolume(getStoredVolume());
|
||||||
|
Loading…
Reference in New Issue
Block a user