Fix camera switching and loading position (#10982)

* Fix alignment

* Set loading when switching cameras
This commit is contained in:
Nicolas Mowen 2024-04-16 14:21:52 -06:00 committed by GitHub
parent d7ae0eedf8
commit a823a18496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,13 @@ export default function DynamicVideoPlayer({
if (!isScrubbing) {
setLoadingTimeout(setTimeout(() => setIsLoading(true), 1000));
}
}, [isScrubbing]);
return () => {
if (loadingTimeout) {
clearTimeout(loadingTimeout)
}
}
}, [camera, isScrubbing]);
const onPlayerLoaded = useCallback(() => {
if (!controller || !startTimestamp) {
@ -179,7 +185,7 @@ export default function DynamicVideoPlayer({
}}
/>
{isLoading && (
<ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x1/2 -translate-y-1/2" />
<ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />
)}
</>
);