mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Fix type error, only show pip if pip is available
This commit is contained in:
parent
78ae77392c
commit
294f31c567
3 changed files with 11 additions and 8 deletions
|
@ -1,10 +1,16 @@
|
|||
import { Icons } from "@/components/Icon";
|
||||
import { VideoPlayerButton } from "@/components/player/internals/Button";
|
||||
import { usePlayerStore } from "@/stores/player/store";
|
||||
import {
|
||||
canPictureInPicture,
|
||||
canWebkitPictureInPicture,
|
||||
} from "@/utils/detectFeatures";
|
||||
|
||||
export function Pip() {
|
||||
const display = usePlayerStore((s) => s.display);
|
||||
|
||||
if (!canPictureInPicture() && !canWebkitPictureInPicture()) return null;
|
||||
|
||||
return (
|
||||
<VideoPlayerButton
|
||||
onClick={() => display?.togglePictureInPicture()}
|
||||
|
|
|
@ -15,7 +15,9 @@ import {
|
|||
canChangeVolume,
|
||||
canFullscreen,
|
||||
canFullscreenAnyElement,
|
||||
canPictureInPicture,
|
||||
canWebkitFullscreen,
|
||||
canWebkitPictureInPicture,
|
||||
} from "@/utils/detectFeatures";
|
||||
import { makeEmitter } from "@/utils/events";
|
||||
|
||||
|
@ -42,14 +44,6 @@ function hlsLevelsToQualities(levels: Level[]): SourceQuality[] {
|
|||
.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 {
|
||||
const { emit, on, off } = makeEmitter<DisplayInterfaceEvents>();
|
||||
let source: LoadableSource | null = null;
|
||||
|
|
|
@ -179,6 +179,9 @@ export function makeChromecastDisplayInterface(
|
|||
if (containerElement) fscreen.requestFullscreen(containerElement);
|
||||
}
|
||||
},
|
||||
togglePictureInPicture() {
|
||||
// Can't PIP while Chromecasting
|
||||
},
|
||||
startAirplay() {
|
||||
// cant airplay while chromecasting
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue