From 17b92aa65753f0abecd193e626a60b17cfa1ad35 Mon Sep 17 00:00:00 2001 From: Peeter N Date: Fri, 5 May 2023 02:02:48 +0300 Subject: [PATCH] Do not show the loader during recordings api call (#6366) * Do not show the loader during recordings api call Showing the loader during the recordings API call will rerender the recordings list and rerenders the video player * Fix defauting to 0 seekSeconds if recordings results are missings --- web/src/routes/Recording.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/routes/Recording.jsx b/web/src/routes/Recording.jsx index 9a40b674c..405549e8b 100644 --- a/web/src/routes/Recording.jsx +++ b/web/src/routes/Recording.jsx @@ -30,7 +30,7 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se // calculates the seek seconds by adding up all the seconds in the segments prior to the playback time const seekSeconds = useMemo(() => { if (!recordings) { - return 0; + return undefined; } const currentUnix = getUnixTime(currentDate); @@ -103,6 +103,9 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se }, [playlistIndex]); useEffect(() => { + if (seekSeconds === undefined) { + return; + } if (this.player) { // if the playlist has moved on to the next item, then reset if (this.player.playlist.currentItem() !== playlistIndex) { @@ -114,7 +117,7 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se } }, [seekSeconds, playlistIndex]); - if (!recordingsSummary || !recordings || !config) { + if (!recordingsSummary || !config) { return ; } @@ -145,7 +148,9 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se player.playlist(playlist); player.playlist.autoadvance(0); player.playlist.currentItem(playlistIndex); - player.currentTime(seekSeconds); + if (seekSeconds !== undefined) { + player.currentTime(seekSeconds); + } this.player = player; } }}