Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
Merge branch 'main' into feat/countdown-before-record-start
Aaryash Khalkarc033984ccb32
diff --cc src/hooks/useScreenRecorder.tsindex ca14dfe8e,b059c2380..913386c1b--- a/src/hooks/useScreenRecorder.ts+++ b/src/hooks/useScreenRecorder.ts@@@ -110,8 -110,8 +110,10 @@@ export function useScreenRecorder(): Usconst allowAutoFinalize = useRef(false);const discardRecordingId = useRef<number | null>(null);const restarting = useRef(false);+ const countdownRunId = useRef(0);+ const [countdownActive, setCountdownActive] = useState(false);+ const webcamReady = useRef(false);+ const webcamAcquireId = useRef(0);const getRecordingDurationMs = useCallback(() => {const segmentDuration =@@@ -562,36 -514,24 +639,29 @@@}}+ if (!isCountdownRunActive(countdownRunToken)) {+ teardownMedia();+ return;+ }+if (webcamEnabled) {- try {- webcamStream.current = await navigator.mediaDevices.getUserMedia({- audio: false,- video: webcamDeviceId- ? {- deviceId: { exact: webcamDeviceId },- width: { ideal: WEBCAM_TARGET_WIDTH },- height: { ideal: WEBCAM_TARGET_HEIGHT },- frameRate: { ideal: WEBCAM_TARGET_FRAME_RATE, max: WEBCAM_TARGET_FRAME_RATE },- }- : {- width: { ideal: WEBCAM_TARGET_WIDTH },- height: { ideal: WEBCAM_TARGET_HEIGHT },- frameRate: { ideal: WEBCAM_TARGET_FRAME_RATE, max: WEBCAM_TARGET_FRAME_RATE },- },+ if (!webcamReady.current) {+ await new Promise<void>((resolve) => {+ const interval = setInterval(() => {+ if (webcamReady.current) {+ clearInterval(interval);+ resolve();+ }+ }, 50);+ setTimeout(() => {+ clearInterval(interval);+ resolve();+ }, 5000);});- } catch (cameraError) {- console.warn("Failed to get webcam access:", cameraError);- if (webcamStream.current) {- webcamStream.current.getTracks().forEach((track) => track.stop());- webcamStream.current = null;- }+ }+ if (!webcamStream.current) {+ webcamAcquireId.current++;setWebcamEnabledState(false);- toast.error(t("recording.cameraDenied"));}}