mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Fix onClick exceptoins
This commit is contained in:
parent
2ae6d631e5
commit
0be5274b01
@ -154,6 +154,7 @@ export default function HlsVideoPlayer({
|
|||||||
const [mobileCtrlTimeout, setMobileCtrlTimeout] = useState<NodeJS.Timeout>();
|
const [mobileCtrlTimeout, setMobileCtrlTimeout] = useState<NodeJS.Timeout>();
|
||||||
const [controls, setControls] = useState(isMobile);
|
const [controls, setControls] = useState(isMobile);
|
||||||
const [controlsOpen, setControlsOpen] = useState(false);
|
const [controlsOpen, setControlsOpen] = useState(false);
|
||||||
|
const [zoomScale, setZoomScale] = useState(1.0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isDesktop) {
|
if (!isDesktop) {
|
||||||
@ -185,7 +186,11 @@ export default function HlsVideoPlayer({
|
|||||||
}, [videoRef, controlsOpen]);
|
}, [videoRef, controlsOpen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}>
|
<TransformWrapper
|
||||||
|
minScale={1.0}
|
||||||
|
wheel={{ smoothStep: 0.005 }}
|
||||||
|
onZoom={(zoom) => setZoomScale(zoom.state.scale)}
|
||||||
|
>
|
||||||
{frigateControls && (
|
{frigateControls && (
|
||||||
<VideoControls
|
<VideoControls
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -267,7 +272,13 @@ export default function HlsVideoPlayer({
|
|||||||
controls={!frigateControls}
|
controls={!frigateControls}
|
||||||
playsInline
|
playsInline
|
||||||
muted={muted}
|
muted={muted}
|
||||||
onClick={() => onPlayPause(!isPlaying)}
|
onClick={
|
||||||
|
isDesktop
|
||||||
|
? () => {
|
||||||
|
if (zoomScale == 1.0) onPlayPause(!isPlaying);
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
onVolumeChange={() =>
|
onVolumeChange={() =>
|
||||||
setVolume(videoRef.current?.volume ?? 1.0, true)
|
setVolume(videoRef.current?.volume ?? 1.0, true)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user