mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
clean up
This commit is contained in:
parent
bd3d5fcab6
commit
51cec1b438
@ -141,7 +141,6 @@ function MSEPlayer({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const reconnect = (timeout?: number) => {
|
const reconnect = (timeout?: number) => {
|
||||||
console.log("reconnecting", camera);
|
|
||||||
setWsState(WebSocket.CONNECTING);
|
setWsState(WebSocket.CONNECTING);
|
||||||
wsRef.current = null;
|
wsRef.current = null;
|
||||||
|
|
||||||
@ -150,22 +149,12 @@ function MSEPlayer({
|
|||||||
|
|
||||||
reconnectTIDRef.current = window.setTimeout(() => {
|
reconnectTIDRef.current = window.setTimeout(() => {
|
||||||
reconnectTIDRef.current = null;
|
reconnectTIDRef.current = null;
|
||||||
console.log("timeout ended, running onconnect", camera);
|
|
||||||
onConnect();
|
onConnect();
|
||||||
}, delay);
|
}, delay);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
console.log(
|
|
||||||
"onClose running for",
|
|
||||||
camera,
|
|
||||||
wsState,
|
|
||||||
"closed?",
|
|
||||||
wsState === WebSocket.CLOSED,
|
|
||||||
);
|
|
||||||
if (wsState === WebSocket.CLOSED) return;
|
if (wsState === WebSocket.CLOSED) return;
|
||||||
console.log("onClose running for", camera, "websocket not closed");
|
|
||||||
|
|
||||||
reconnect();
|
reconnect();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -308,10 +297,6 @@ function MSEPlayer({
|
|||||||
videoRef.current.requestPictureInPicture();
|
videoRef.current.requestPictureInPicture();
|
||||||
}, [pip, videoRef]);
|
}, [pip, videoRef]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(camera, wsState);
|
|
||||||
}, [camera, wsState]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<video
|
<video
|
||||||
ref={videoRef}
|
ref={videoRef}
|
||||||
@ -321,18 +306,8 @@ function MSEPlayer({
|
|||||||
onLoadedData={onPlaying}
|
onLoadedData={onPlaying}
|
||||||
onLoadedMetadata={handleLoadedMetadata}
|
onLoadedMetadata={handleLoadedMetadata}
|
||||||
muted={!audioEnabled}
|
muted={!audioEnabled}
|
||||||
onError={(e) => {
|
onError={() => {
|
||||||
console.log("onError event", e);
|
|
||||||
const videoElement = e.target as HTMLVideoElement;
|
|
||||||
if (videoElement.error) {
|
|
||||||
console.log("Video Error Code:", videoElement.error.code);
|
|
||||||
console.log("Video Error Message:", videoElement.error.message);
|
|
||||||
} else {
|
|
||||||
console.log("An unknown error occurred");
|
|
||||||
}
|
|
||||||
console.log("Camera object:", camera);
|
|
||||||
if (wsRef.current) {
|
if (wsRef.current) {
|
||||||
console.log("websocket is", wsState);
|
|
||||||
wsRef.current.close();
|
wsRef.current.close();
|
||||||
wsRef.current = null;
|
wsRef.current = null;
|
||||||
reconnect(5000);
|
reconnect(5000);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user