reset when changing main cam

This commit is contained in:
Josh Hawkins 2024-04-29 21:45:12 -05:00
parent d029507c1c
commit 20f6b7e7c1
2 changed files with 10 additions and 6 deletions

View File

@ -48,8 +48,8 @@ export default function HlsVideoPlayer({
const [loadedMetadata, setLoadedMetadata] = useState(false);
const handleLoadedMetadata = useCallback(() => {
setLoadedMetadata(true);
if (videoRef.current) {
setLoadedMetadata(true);
if (setLiveResolution) {
setLiveResolution({
width: videoRef.current.videoWidth,

View File

@ -190,9 +190,18 @@ export function RecordingView({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentTime, scrubbing]);
const [liveResolution, setLiveResolution] = useState<VideoResolutionType>({
width: 0,
height: 0,
});
const onSelectCamera = useCallback(
(newCam: string) => {
setMainCamera(newCam);
setLiveResolution({
width: 0,
height: 0,
});
setPlaybackStart(currentTime);
},
[currentTime],
@ -200,11 +209,6 @@ export function RecordingView({
// motion timeline data
const [liveResolution, setLiveResolution] = useState<VideoResolutionType>({
width: 0,
height: 0,
});
const getCameraAspect = useCallback(
(cam: string) => {
if (!config) {