mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 04:35:25 +03:00
Fix touch controls for mobile
This commit is contained in:
parent
7550ad627c
commit
a14198be7e
@ -152,6 +152,19 @@ export default function DynamicVideoPlayer({
|
|||||||
onKeyboardShortcut,
|
onKeyboardShortcut,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// mobile tap controls
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isDesktop || !playerRef) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const callback = () => setControls(!controls);
|
||||||
|
playerRef.on("touchstart", callback);
|
||||||
|
|
||||||
|
return () => playerRef.off("touchstart", callback);
|
||||||
|
}, [controls, playerRef]);
|
||||||
|
|
||||||
// initial state
|
// initial state
|
||||||
|
|
||||||
const initialPlaybackSource = useMemo(() => {
|
const initialPlaybackSource = useMemo(() => {
|
||||||
@ -238,14 +251,6 @@ export default function DynamicVideoPlayer({
|
|||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
onClick={
|
|
||||||
isMobile
|
|
||||||
? (e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setControls(!controls);
|
|
||||||
}
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<div className={`w-full relative ${isScrubbing ? "hidden" : "visible"}`}>
|
<div className={`w-full relative ${isScrubbing ? "hidden" : "visible"}`}>
|
||||||
<VideoPlayer
|
<VideoPlayer
|
||||||
@ -255,9 +260,8 @@ export default function DynamicVideoPlayer({
|
|||||||
sources: [initialPlaybackSource],
|
sources: [initialPlaybackSource],
|
||||||
aspectRatio: wideVideo ? undefined : "16:9",
|
aspectRatio: wideVideo ? undefined : "16:9",
|
||||||
controls: false,
|
controls: false,
|
||||||
nativeControlsForTouch: true,
|
nativeControlsForTouch: false,
|
||||||
}}
|
}}
|
||||||
seekOptions={{ forward: 10, backward: 5 }}
|
|
||||||
onReady={(player) => {
|
onReady={(player) => {
|
||||||
setPlayerRef(player);
|
setPlayerRef(player);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user