mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 00:11:15 +03:00
skip unnecessary MSEPlayer remount on initial render
se a previous-value ref for the streamName effect in LivePlayer to avoid a wasted WebSocket connect/disconnect cycle
This commit is contained in:
parent
f3a9bf7763
commit
fa7858a1c9
@ -195,6 +195,7 @@ export default function LivePlayer({
|
||||
}, [preferredLiveMode]);
|
||||
|
||||
const [key, setKey] = useState(0);
|
||||
const prevStreamNameRef = useRef(streamName);
|
||||
|
||||
const resetPlayer = () => {
|
||||
setLiveReady(false);
|
||||
@ -202,8 +203,11 @@ export default function LivePlayer({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (streamName) {
|
||||
resetPlayer();
|
||||
if (prevStreamNameRef.current !== streamName) {
|
||||
prevStreamNameRef.current = streamName;
|
||||
if (streamName) {
|
||||
resetPlayer();
|
||||
}
|
||||
}
|
||||
}, [streamName]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user