diff --git a/www/atoms/local.ts b/www/atoms/local.ts index a0b5566..87ffe6c 100644 --- a/www/atoms/local.ts +++ b/www/atoms/local.ts @@ -44,7 +44,7 @@ export const localState = atom({ const setAudioVideoEnabled = (audioEnabled: boolean, videoEnabled: boolean) => (local: Local): Local => { - assert(local.status === "connecting" || local.status === "connected"); + assert(local.status === "requestingDevices" || local.status === "connecting" || local.status === "connected"); return { ...local, audioEnabled, videoEnabled }; }; diff --git a/www/components/room/controls.tsx b/www/components/room/controls.tsx index 1473c16..33a29fc 100644 --- a/www/components/room/controls.tsx +++ b/www/components/room/controls.tsx @@ -41,7 +41,7 @@ function TrackControl(track: "video" | "audio") { const peers = useRecoilValue(peersState); const stream = mapGet(streamMap, LocalStreamKey); - assert(local.status === "connecting" || local.status === "connected"); + assert(local.status === "requestingDevices" || local.status === "connecting" || local.status === "connected"); const { audioEnabled, videoEnabled } = getVideoAudioEnabled(stream); const enabled = track === "audio" ? audioEnabled : videoEnabled; @@ -97,11 +97,11 @@ function TrackControl(track: "video" | "audio") { ); } -function AudioControl() { +export function AudioControl() { return TrackControl("audio"); } -function VideoControl() { +export function VideoControl() { return TrackControl("video"); } diff --git a/www/components/room/request-devices.tsx b/www/components/room/request-devices.tsx index 03db4f0..8f76ce0 100644 --- a/www/components/room/request-devices.tsx +++ b/www/components/room/request-devices.tsx @@ -11,6 +11,7 @@ import { stopStream, } from "../../lib/mesh/stream"; import Select from "../lib/select"; +import {AudioControl, VideoControl} from "./controls"; import LocalPreview from "./local-preview"; import PreForm from "./pre-form"; @@ -108,6 +109,7 @@ export default function RequestDevices() { } setValue={handleAudioChange} /> +