diff --git a/plugins/love-resources/src/components/MicSettingPopup.svelte b/plugins/love-resources/src/components/MicSettingPopup.svelte index f7774677e2..db7be747a3 100644 --- a/plugins/love-resources/src/components/MicSettingPopup.svelte +++ b/plugins/love-resources/src/components/MicSettingPopup.svelte @@ -12,10 +12,12 @@ void Room.getLocalDevices().then(async (devices) => { devices.forEach((device) => { - if (device.kind === 'audiooutput') { - speakers.push({ label: device.label, id: device.deviceId }) - } else if (device.kind === 'audioinput') { - mics.push({ label: device.label, id: device.deviceId }) + if (device.deviceId !== 'default') { + if (device.kind === 'audiooutput') { + speakers.push({ label: device.label, id: device.deviceId }) + } else if (device.kind === 'audioinput') { + mics.push({ label: device.label, id: device.deviceId }) + } } }) if (speakers.length === 0) { diff --git a/plugins/love-resources/src/utils.ts b/plugins/love-resources/src/utils.ts index aea663d6f6..61920b6aec 100644 --- a/plugins/love-resources/src/utils.ts +++ b/plugins/love-resources/src/utils.ts @@ -435,6 +435,18 @@ export async function setCam (value: boolean): Promise { export async function setMic (value: boolean): Promise { if ($isCurrentInstanceConnected) { + try { + const speaker = localStorage.getItem(selectedSpeakerId) + if (speaker !== null) { + const devices = await LKRoom.getLocalDevices('audiooutput') + const available = devices.find((p) => p.deviceId === speaker) + if (available !== undefined) { + await lk.switchActiveDevice('audiooutput', speaker) + } + } + } catch (err) { + console.error(err) + } try { const opt: AudioCaptureOptions = {} const selectedDevice = localStorage.getItem(selectedMicId)