From b8d78ce13fbb6b3243061d27330911062ea956e5 Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Fri, 29 Sep 2023 22:14:24 +0600 Subject: [PATCH] Camera switching: fixed camera switching even if camera web recorder is broken --- .../video-upload-recorder-actions.tsx | 13 ++++++++- .../video-upload-recorder.tsx | 29 +++++++++---------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/common/components/video-upload-threespeak/video-upload-recorder-actions.tsx b/src/common/components/video-upload-threespeak/video-upload-recorder-actions.tsx index f558e0cfbb9..e43fb4f250e 100644 --- a/src/common/components/video-upload-threespeak/video-upload-recorder-actions.tsx +++ b/src/common/components/video-upload-threespeak/video-upload-recorder-actions.tsx @@ -5,10 +5,16 @@ import { useGetCameraList } from "./utils"; interface Props { noPermission: boolean; mediaRecorder?: MediaRecorder; + recordButtonShow?: boolean; onCameraSelect: (camera: MediaDeviceInfo) => void; } -export function VideoUploadRecorderActions({ noPermission, mediaRecorder, onCameraSelect }: Props) { +export function VideoUploadRecorderActions({ + noPermission, + mediaRecorder, + onCameraSelect, + recordButtonShow +}: Props) { const cameraList = useGetCameraList(); const [currentCameraIndex, setCurrentCameraIndex] = useState(0); @@ -48,6 +54,9 @@ export function VideoUploadRecorderActions({ noPermission, mediaRecorder, onCame {rectSvg} ) : ( + <> + )} + {!recordStarted && recordButtonShow ? (
{circleSvg}
+ ) : ( + <> )}
diff --git a/src/common/components/video-upload-threespeak/video-upload-recorder.tsx b/src/common/components/video-upload-threespeak/video-upload-recorder.tsx index a3e9a762ea7..f2e7ec5a7fe 100644 --- a/src/common/components/video-upload-threespeak/video-upload-recorder.tsx +++ b/src/common/components/video-upload-threespeak/video-upload-recorder.tsx @@ -103,22 +103,19 @@ export function VideoUploadRecorder({ <> )} - {!noPermission && !recordedVideoSrc ? ( - { - stream - ?.getTracks() - .filter(({ kind }) => kind === "video") - .forEach((track) => track.stop()); - - setCurrentCamera(camera); - }} - /> - ) : ( - <> - )} + { + stream + ?.getTracks() + .filter(({ kind }) => kind === "video") + .forEach((track) => track.stop()); + + setCurrentCamera(camera); + }} + /> {noPermission ? (