Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Initialize microphone input on mount and effect

Richie McIlroya5e7f1f7f514
diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx
index f1cb10010..31b49cb33 100644
--- a/apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx
@@ -4,8 +4,8 @@ import { cx } from "cva";
import {
type Component,
type ComponentProps,
+ createEffect,
createSignal,
- onMount,
Show,
} from "solid-js";
import { trackEvent } from "~/utils/analytics";
@@ -83,12 +83,10 @@ export function MicrophoneSelectBase(props: {
const audioLevel = () =>
(1 - Math.max((dbs() ?? 0) + DB_SCALE, 0) / DB_SCALE) ** 0.5;
- // Initialize audio input if needed - only once when component mounts
- onMount(() => {
+ createEffect(() => {
if (!props.value || !permissionGranted() || isInitialized()) return;
setIsInitialized(true);
- // Ensure the selected microphone is activated so levels flow in
void handleMicrophoneChange({ name: props.value });
});
diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
index 7e92e7e3b..abb7c2a48 100644
--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
@@ -616,6 +616,8 @@ function Page() {
const setCamera = createCameraMutation();
onMount(() => {
+ if (rawOptions.micName) void commands.setMicInput(rawOptions.micName);
+
if (rawOptions.cameraID && "ModelID" in rawOptions.cameraID)
setCamera.mutate({ ModelID: rawOptions.cameraID.ModelID });
else if (rawOptions.cameraID && "DeviceID" in rawOptions.cameraID)