mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 22:25:24 +03:00
revert to inline funcs
This commit is contained in:
parent
bdad02bff9
commit
c79c631712
@ -372,7 +372,13 @@ function MSEPlayer({
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [playbackEnabled]);
|
}, [playbackEnabled]);
|
||||||
|
|
||||||
const handleLoadedData = useCallback(() => {
|
return (
|
||||||
|
<video
|
||||||
|
ref={videoRef}
|
||||||
|
className={className}
|
||||||
|
playsInline
|
||||||
|
preload="auto"
|
||||||
|
onLoadedData={() => {
|
||||||
handleLoadedMetadata?.();
|
handleLoadedMetadata?.();
|
||||||
if (playTimeoutRef.current) {
|
if (playTimeoutRef.current) {
|
||||||
clearTimeout(playTimeoutRef.current);
|
clearTimeout(playTimeoutRef.current);
|
||||||
@ -380,12 +386,14 @@ function MSEPlayer({
|
|||||||
}
|
}
|
||||||
onPlaying?.();
|
onPlaying?.();
|
||||||
setIsPlaying(true);
|
setIsPlaying(true);
|
||||||
}, [handleLoadedMetadata, onPlaying]);
|
}}
|
||||||
|
muted={!audioEnabled}
|
||||||
const handleProgress = useCallback(() => {
|
onPause={() => videoRef.current?.play()}
|
||||||
|
onProgress={() => {
|
||||||
if (!isPlaying && !playTimeoutRef.current && playbackEnabled) {
|
if (!isPlaying && !playTimeoutRef.current && playbackEnabled) {
|
||||||
playTimeoutRef.current = setTimeout(() => {
|
playTimeoutRef.current = setTimeout(() => {
|
||||||
handleLoadedData();
|
setIsPlaying(true);
|
||||||
|
onPlaying?.();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
if (onError != undefined) {
|
if (onError != undefined) {
|
||||||
@ -411,26 +419,7 @@ function MSEPlayer({
|
|||||||
}, 3000),
|
}, 3000),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [
|
}}
|
||||||
isPlaying,
|
|
||||||
onError,
|
|
||||||
videoRef,
|
|
||||||
bufferTimeout,
|
|
||||||
onDisconnect,
|
|
||||||
handleLoadedData,
|
|
||||||
playbackEnabled,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<video
|
|
||||||
ref={videoRef}
|
|
||||||
className={className}
|
|
||||||
playsInline
|
|
||||||
preload="auto"
|
|
||||||
onLoadedData={handleLoadedData}
|
|
||||||
muted={!audioEnabled}
|
|
||||||
onPause={() => videoRef.current?.play()}
|
|
||||||
onProgress={handleProgress}
|
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
if (
|
if (
|
||||||
// @ts-expect-error code does exist
|
// @ts-expect-error code does exist
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user