mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix flashing of previous still image when live player stops (#12458)
This commit is contained in:
parent
82d2910039
commit
c850604931
@ -79,7 +79,7 @@ export default function LivePlayer({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cameraActive) {
|
if (!cameraActive) {
|
||||||
setLiveReady(false);
|
setTimeout(() => setLiveReady(false), 500);
|
||||||
}
|
}
|
||||||
// live mode won't change
|
// live mode won't change
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// 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
|
return -1; // no reason to update the image when the window is not visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (liveReady && !cameraActive) {
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
|
||||||
if (liveReady) {
|
if (liveReady) {
|
||||||
return 60000;
|
return 60000;
|
||||||
}
|
}
|
||||||
@ -113,6 +117,7 @@ export default function LivePlayer({
|
|||||||
activeTracking,
|
activeTracking,
|
||||||
offline,
|
offline,
|
||||||
windowVisible,
|
windowVisible,
|
||||||
|
cameraActive,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -135,7 +140,7 @@ export default function LivePlayer({
|
|||||||
<WebRtcPlayer
|
<WebRtcPlayer
|
||||||
className={`size-full rounded-lg md:rounded-2xl ${liveReady ? "" : "hidden"}`}
|
className={`size-full rounded-lg md:rounded-2xl ${liveReady ? "" : "hidden"}`}
|
||||||
camera={cameraConfig.live.stream_name}
|
camera={cameraConfig.live.stream_name}
|
||||||
playbackEnabled={cameraActive}
|
playbackEnabled={cameraActive || liveReady}
|
||||||
audioEnabled={playAudio}
|
audioEnabled={playAudio}
|
||||||
microphoneEnabled={micEnabled}
|
microphoneEnabled={micEnabled}
|
||||||
iOSCompatFullScreen={iOSCompatFullScreen}
|
iOSCompatFullScreen={iOSCompatFullScreen}
|
||||||
@ -150,7 +155,7 @@ export default function LivePlayer({
|
|||||||
<MSEPlayer
|
<MSEPlayer
|
||||||
className={`size-full rounded-lg md:rounded-2xl ${liveReady ? "" : "hidden"}`}
|
className={`size-full rounded-lg md:rounded-2xl ${liveReady ? "" : "hidden"}`}
|
||||||
camera={cameraConfig.live.stream_name}
|
camera={cameraConfig.live.stream_name}
|
||||||
playbackEnabled={cameraActive}
|
playbackEnabled={cameraActive || liveReady}
|
||||||
audioEnabled={playAudio}
|
audioEnabled={playAudio}
|
||||||
onPlaying={playerIsPlaying}
|
onPlaying={playerIsPlaying}
|
||||||
pip={pip}
|
pip={pip}
|
||||||
@ -166,14 +171,16 @@ export default function LivePlayer({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (liveMode == "jsmpeg") {
|
} else if (liveMode == "jsmpeg") {
|
||||||
if (cameraActive || !showStillWithoutActivity) {
|
if (cameraActive || !showStillWithoutActivity || liveReady) {
|
||||||
player = (
|
player = (
|
||||||
<JSMpegPlayer
|
<JSMpegPlayer
|
||||||
className="flex justify-center overflow-hidden rounded-lg md:rounded-2xl"
|
className="flex justify-center overflow-hidden rounded-lg md:rounded-2xl"
|
||||||
camera={cameraConfig.name}
|
camera={cameraConfig.name}
|
||||||
width={cameraConfig.detect.width}
|
width={cameraConfig.detect.width}
|
||||||
height={cameraConfig.detect.height}
|
height={cameraConfig.detect.height}
|
||||||
playbackEnabled={cameraActive || !showStillWithoutActivity}
|
playbackEnabled={
|
||||||
|
cameraActive || !showStillWithoutActivity || liveReady
|
||||||
|
}
|
||||||
containerRef={containerRef ?? internalContainerRef}
|
containerRef={containerRef ?? internalContainerRef}
|
||||||
onPlaying={playerIsPlaying}
|
onPlaying={playerIsPlaying}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user