mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 04:35:25 +03:00
Simplify
This commit is contained in:
parent
61cc47034e
commit
53638cac9e
@ -45,7 +45,6 @@ export default function PreviewVideoPlayer({
|
|||||||
// controlling playback
|
// controlling playback
|
||||||
|
|
||||||
const previewRef = useRef<HTMLVideoElement | null>(null);
|
const previewRef = useRef<HTMLVideoElement | null>(null);
|
||||||
const [previewReady, setPreviewReady] = useState(false);
|
|
||||||
const controller = useMemo(() => {
|
const controller = useMemo(() => {
|
||||||
if (!config || !previewRef.current) {
|
if (!config || !previewRef.current) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -54,7 +53,7 @@ export default function PreviewVideoPlayer({
|
|||||||
return new PreviewVideoController(camera, previewRef);
|
return new PreviewVideoController(camera, previewRef);
|
||||||
// we only care when preview is ready
|
// we only care when preview is ready
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [camera, config, previewReady]);
|
}, [camera, config, previewRef.current]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
@ -135,7 +134,6 @@ export default function PreviewVideoPlayer({
|
|||||||
onSeeked={onPreviewSeeked}
|
onSeeked={onPreviewSeeked}
|
||||||
onLoadedData={() => {
|
onLoadedData={() => {
|
||||||
previewRef.current?.pause();
|
previewRef.current?.pause();
|
||||||
setPreviewReady(true);
|
|
||||||
controller?.previewReady();
|
controller?.previewReady();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user