mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-13 08:35:08 +01:00
Fix type error, only show pip if pip is available
This commit is contained in:
parent
78ae77392c
commit
294f31c567
@ -1,10 +1,16 @@
|
|||||||
import { Icons } from "@/components/Icon";
|
import { Icons } from "@/components/Icon";
|
||||||
import { VideoPlayerButton } from "@/components/player/internals/Button";
|
import { VideoPlayerButton } from "@/components/player/internals/Button";
|
||||||
import { usePlayerStore } from "@/stores/player/store";
|
import { usePlayerStore } from "@/stores/player/store";
|
||||||
|
import {
|
||||||
|
canPictureInPicture,
|
||||||
|
canWebkitPictureInPicture,
|
||||||
|
} from "@/utils/detectFeatures";
|
||||||
|
|
||||||
export function Pip() {
|
export function Pip() {
|
||||||
const display = usePlayerStore((s) => s.display);
|
const display = usePlayerStore((s) => s.display);
|
||||||
|
|
||||||
|
if (!canPictureInPicture() && !canWebkitPictureInPicture()) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VideoPlayerButton
|
<VideoPlayerButton
|
||||||
onClick={() => display?.togglePictureInPicture()}
|
onClick={() => display?.togglePictureInPicture()}
|
||||||
|
@ -15,7 +15,9 @@ import {
|
|||||||
canChangeVolume,
|
canChangeVolume,
|
||||||
canFullscreen,
|
canFullscreen,
|
||||||
canFullscreenAnyElement,
|
canFullscreenAnyElement,
|
||||||
|
canPictureInPicture,
|
||||||
canWebkitFullscreen,
|
canWebkitFullscreen,
|
||||||
|
canWebkitPictureInPicture,
|
||||||
} from "@/utils/detectFeatures";
|
} from "@/utils/detectFeatures";
|
||||||
import { makeEmitter } from "@/utils/events";
|
import { makeEmitter } from "@/utils/events";
|
||||||
|
|
||||||
@ -42,14 +44,6 @@ function hlsLevelsToQualities(levels: Level[]): SourceQuality[] {
|
|||||||
.filter((v): v is SourceQuality => !!v);
|
.filter((v): v is SourceQuality => !!v);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canWebkitPictureInPicture(): boolean {
|
|
||||||
return "webkitSupportsPresentationMode" in document.createElement("video");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function canPictureInPicture(): boolean {
|
|
||||||
return "pictureInPictureEnabled" in document;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function makeVideoElementDisplayInterface(): DisplayInterface {
|
export function makeVideoElementDisplayInterface(): DisplayInterface {
|
||||||
const { emit, on, off } = makeEmitter<DisplayInterfaceEvents>();
|
const { emit, on, off } = makeEmitter<DisplayInterfaceEvents>();
|
||||||
let source: LoadableSource | null = null;
|
let source: LoadableSource | null = null;
|
||||||
|
@ -179,6 +179,9 @@ export function makeChromecastDisplayInterface(
|
|||||||
if (containerElement) fscreen.requestFullscreen(containerElement);
|
if (containerElement) fscreen.requestFullscreen(containerElement);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
togglePictureInPicture() {
|
||||||
|
// Can't PIP while Chromecasting
|
||||||
|
},
|
||||||
startAirplay() {
|
startAirplay() {
|
||||||
// cant airplay while chromecasting
|
// cant airplay while chromecasting
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user