Fix showing loading indicator when first loading a camera without previews (#12064)

This commit is contained in:
Nicolas Mowen 2024-06-19 08:52:45 -06:00 committed by GitHub
parent c72d304515
commit d01457e64d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,6 +172,12 @@ function PreviewVideoPlayer({
const [firstLoad, setFirstLoad] = useState(true); const [firstLoad, setFirstLoad] = useState(true);
useEffect(() => {
if (cameraPreviews && cameraPreviews.length > 0) {
setFirstLoad(false);
}
}, [cameraPreviews]);
const [currentPreview, setCurrentPreview] = useState(initialPreview); const [currentPreview, setCurrentPreview] = useState(initialPreview);
const onPreviewSeeked = useCallback(() => { const onPreviewSeeked = useCallback(() => {