Skip to content

NVR with realtime local object detection for IP cameras

Fix flashing of previous still image when live player stops (#12458)

Josh Hawkinsc850604931dd
diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx
index 5d3129ffe7..1ff5c5f376 100644
--- a/web/src/components/player/LivePlayer.tsx
+++ b/web/src/components/player/LivePlayer.tsx
@@ -79,7 +79,7 @@ export default function LivePlayer({
}
if (!cameraActive) {
- setLiveReady(false);
+ setTimeout(() => setLiveReady(false), 500);
}
// live mode won't change
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -92,6 +92,10 @@ export default function LivePlayer({
return -1; // no reason to update the image when the window is not visible
}
+ if (liveReady && !cameraActive) {
+ return 300;
+ }
+
if (liveReady) {
return 60000;
}
@@ -113,6 +117,7 @@ export default function LivePlayer({
activeTracking,
offline,
windowVisible,
+ cameraActive,
]);
useEffect(() => {
@@ -135,7 +140,7 @@ export default function LivePlayer({
<WebRtcPlayer
className={`size-full rounded-lg md:rounded-2xl ${liveReady ? "" : "hidden"}`}
camera={cameraConfig.live.stream_name}
- playbackEnabled={cameraActive}
+ playbackEnabled={cameraActive || liveReady}
audioEnabled={playAudio}
microphoneEnabled={micEnabled}
iOSCompatFullScreen={iOSCompatFullScreen}
@@ -150,7 +155,7 @@ export default function LivePlayer({
<MSEPlayer
className={`size-full rounded-lg md:rounded-2xl ${liveReady ? "" : "hidden"}`}
camera={cameraConfig.live.stream_name}
- playbackEnabled={cameraActive}
+ playbackEnabled={cameraActive || liveReady}
audioEnabled={playAudio}
onPlaying={playerIsPlaying}
pip={pip}
@@ -166,14 +171,16 @@ export default function LivePlayer({
);
}
} else if (liveMode == "jsmpeg") {
- if (cameraActive || !showStillWithoutActivity) {
+ if (cameraActive || !showStillWithoutActivity || liveReady) {
player = (
<JSMpegPlayer
className="flex justify-center overflow-hidden rounded-lg md:rounded-2xl"
camera={cameraConfig.name}
width={cameraConfig.detect.width}
height={cameraConfig.detect.height}
- playbackEnabled={cameraActive || !showStillWithoutActivity}
+ playbackEnabled={
+ cameraActive || !showStillWithoutActivity || liveReady
+ }
containerRef={containerRef ?? internalContainerRef}
onPlaying={playerIsPlaying}
/>