mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 22:55:26 +03:00
fallback to webrtc if enabled before jsmpeg
This commit is contained in:
parent
af4bc9b466
commit
8f44cc3725
@ -139,6 +139,13 @@ function MSEPlayer({
|
|||||||
}
|
}
|
||||||
}, [bufferTimeout]);
|
}, [bufferTimeout]);
|
||||||
|
|
||||||
|
const handlePause = useCallback(() => {
|
||||||
|
// don't let the user pause the live stream
|
||||||
|
if (isPlaying && playbackEnabled) {
|
||||||
|
videoRef.current?.play();
|
||||||
|
}
|
||||||
|
}, [isPlaying, playbackEnabled]);
|
||||||
|
|
||||||
const onOpen = () => {
|
const onOpen = () => {
|
||||||
setWsState(WebSocket.OPEN);
|
setWsState(WebSocket.OPEN);
|
||||||
|
|
||||||
@ -402,7 +409,7 @@ function MSEPlayer({
|
|||||||
lastJumpTimeRef.current = Date.now();
|
lastJumpTimeRef.current = Date.now();
|
||||||
}}
|
}}
|
||||||
muted={!audioEnabled}
|
muted={!audioEnabled}
|
||||||
onPause={() => videoRef.current?.play()}
|
onPause={handlePause}
|
||||||
onProgress={() => {
|
onProgress={() => {
|
||||||
const bufferTime = getBufferedTime(videoRef.current);
|
const bufferTime = getBufferedTime(videoRef.current);
|
||||||
|
|
||||||
|
|||||||
@ -298,7 +298,12 @@ export interface FrigateConfig {
|
|||||||
retry_interval: number;
|
retry_interval: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
go2rtc: Record<string, unknown>;
|
go2rtc: {
|
||||||
|
streams: string[];
|
||||||
|
webrtc: {
|
||||||
|
candidates: string[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
camera_groups: { [groupName: string]: CameraGroupConfig };
|
camera_groups: { [groupName: string]: CameraGroupConfig };
|
||||||
|
|
||||||
|
|||||||
@ -286,14 +286,25 @@ export default function LiveCameraView({
|
|||||||
}
|
}
|
||||||
}, [fullscreen, isPortrait, cameraAspectRatio, containerAspectRatio]);
|
}, [fullscreen, isPortrait, cameraAspectRatio, containerAspectRatio]);
|
||||||
|
|
||||||
const handleError = useCallback((e: LivePlayerError) => {
|
const handleError = useCallback(
|
||||||
if (e == "mse-decode") {
|
(e: LivePlayerError) => {
|
||||||
|
if (e) {
|
||||||
|
if (
|
||||||
|
!webRTC &&
|
||||||
|
config &&
|
||||||
|
config.go2rtc?.webrtc?.candidates?.length > 0
|
||||||
|
) {
|
||||||
|
// console.log(camera.name, "switching to webrtc");
|
||||||
setWebRTC(true);
|
setWebRTC(true);
|
||||||
} else {
|
} else {
|
||||||
|
// console.log(camera.name, "switching to jsmpeg");
|
||||||
setWebRTC(false);
|
setWebRTC(false);
|
||||||
setLowBandwidth(true);
|
setLowBandwidth(true);
|
||||||
}
|
}
|
||||||
}, []);
|
}
|
||||||
|
},
|
||||||
|
[config, webRTC],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}>
|
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user