Drop camera settings from join room dialog
This commit is contained in:
@@ -26,21 +26,16 @@
|
||||
const spaceLabel = $derived(displayRelayUrl(url))
|
||||
|
||||
let audioInputs = $state<MediaDeviceInfo[]>([])
|
||||
let videoInputs = $state<MediaDeviceInfo[]>([])
|
||||
let selectedDeviceId = $state("")
|
||||
let selectedVideoDeviceId = $state("")
|
||||
let startWithoutMic = $state(false)
|
||||
let joinWithCamera = $state(false)
|
||||
|
||||
const loadDevices = async () => {
|
||||
if (!navigator.mediaDevices?.enumerateDevices) return
|
||||
try {
|
||||
const devices = await navigator.mediaDevices.enumerateDevices()
|
||||
audioInputs = devices.filter(d => d.kind === "audioinput")
|
||||
videoInputs = devices.filter(d => d.kind === "videoinput")
|
||||
} catch {
|
||||
audioInputs = []
|
||||
videoInputs = []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +52,6 @@
|
||||
h,
|
||||
startWithoutMic,
|
||||
startWithoutMic ? undefined : selectedDeviceId || undefined,
|
||||
joinWithCamera,
|
||||
joinWithCamera ? selectedVideoDeviceId || undefined : undefined,
|
||||
)
|
||||
}
|
||||
</script>
|
||||
@@ -76,7 +69,7 @@
|
||||
</span>
|
||||
</ModalSubtitle>
|
||||
</ModalHeader>
|
||||
<p class="text-sm opacity-80">Choose devices for the call:</p>
|
||||
<p class="text-sm opacity-80">Select a microphone to join the call:</p>
|
||||
<div class="flex flex-col gap-4 pt-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<input
|
||||
@@ -107,34 +100,6 @@
|
||||
</select>
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
<div class="flex items-center gap-2">
|
||||
<input
|
||||
id="voice-join-with-camera"
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
bind:checked={joinWithCamera} />
|
||||
<label for="voice-join-with-camera" class="cursor-pointer text-sm"
|
||||
>Turn camera on when joining</label>
|
||||
</div>
|
||||
<FieldInline>
|
||||
{#snippet label()}
|
||||
<p>Camera</p>
|
||||
{/snippet}
|
||||
{#snippet input()}
|
||||
<select
|
||||
class="select select-bordered w-full"
|
||||
bind:value={selectedVideoDeviceId}
|
||||
disabled={!joinWithCamera}
|
||||
aria-label="Camera">
|
||||
<option value="">Default camera</option>
|
||||
{#each videoInputs as d (d.deviceId)}
|
||||
<option value={d.deviceId}>
|
||||
{d.label || `Camera ${d.deviceId.slice(0, 8)}…`}
|
||||
</option>
|
||||
{/each}
|
||||
</select>
|
||||
{/snippet}
|
||||
</FieldInline>
|
||||
</div>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
|
||||
+1
-18
@@ -11,7 +11,6 @@ import {
|
||||
Track,
|
||||
supportsAudioOutputSelection,
|
||||
type AudioCaptureOptions,
|
||||
type VideoCaptureOptions,
|
||||
} from "livekit-client"
|
||||
import {derived, get, writable} from "svelte/store"
|
||||
import {map, removeUndefined, uniqBy} from "@welshman/lib"
|
||||
@@ -291,8 +290,6 @@ export const joinVoiceRoom = async (
|
||||
h: string,
|
||||
startMuted = true,
|
||||
preferredMicId?: string,
|
||||
joinWithCamera = false,
|
||||
preferredCameraId?: string,
|
||||
): Promise<void> => {
|
||||
cancelJoinVoiceRoom()
|
||||
|
||||
@@ -343,26 +340,12 @@ export const joinVoiceRoom = async (
|
||||
|
||||
const muted = await setUpMicrophone(startMuted, preferredMicId, liveKitRoom.localParticipant)
|
||||
|
||||
let cameraOn = false
|
||||
if (joinWithCamera) {
|
||||
const videoCapture: VideoCaptureOptions | undefined = preferredCameraId
|
||||
? {deviceId: preferredCameraId}
|
||||
: undefined
|
||||
try {
|
||||
await liveKitRoom.localParticipant.setCameraEnabled(true, videoCapture)
|
||||
cameraOn = true
|
||||
bumpVideoCallLayoutRevision()
|
||||
} catch (e) {
|
||||
pushToast({theme: "error", message: "Could not access camera"})
|
||||
}
|
||||
}
|
||||
|
||||
currentVoiceSession.set({
|
||||
url,
|
||||
h,
|
||||
room: liveKitRoom,
|
||||
muted,
|
||||
cameraOn,
|
||||
cameraOn: false,
|
||||
screenShareOn: false,
|
||||
})
|
||||
voiceState.set(VoiceState.Connected)
|
||||
|
||||
Reference in New Issue
Block a user