Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

🚸(frontend) auto-select single audio output device for smoother UX

lebaudantoined2bde299bee8
diff --git a/src/frontend/src/features/rooms/components/join/SelectDevice.tsx b/src/frontend/src/features/rooms/components/join/SelectDevice.tsx
index 1981b0fa..3d151ff2 100644
--- a/src/frontend/src/features/rooms/components/join/SelectDevice.tsx
+++ b/src/frontend/src/features/rooms/components/join/SelectDevice.tsx
@@ -6,7 +6,7 @@ import {
} from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useMediaDeviceSelect } from '@livekit/components-react'
-import { useMemo } from 'react'
+import { useEffect, useMemo } from 'react'
import { Select } from '@/primitives/Select'
import { useSnapshot } from 'valtio'
import { permissionsStore } from '@/stores/permissions'
@@ -45,6 +45,22 @@ const SelectDevicePermissions = ({
label: d.label,
}))
+ /**
+ * FALLBACK AUDIO OUTPUT DEVICE SELECTION
+ * Auto-selects the only available audio output device when currently on 'default'
+ */
+ useEffect(() => {
+ if (
+ kind !== 'audiooutput' ||
+ items.length !== 1 ||
+ items[0].value === 'default' ||
+ activeDeviceId !== 'default'
+ )
+ return
+ onSubmit?.(items[0].value)
+ setActiveMediaDevice(items[0].value)
+ }, [items, onSubmit, kind, setActiveMediaDevice, activeDeviceId])
+
return (
<Select
aria-label={t(`${kind}.choose`)}
@@ -52,7 +68,11 @@ const SelectDevicePermissions = ({
isDisabled={items.length === 0}
items={items}
iconComponent={config?.icon}
- placeholder={t('selectDevice.loading')}
+ placeholder={
+ items.length === 0
+ ? t('selectDevice.loading')
+ : t('selectDevice.select')
+ }
selectedKey={id || activeDeviceId}
onSelectionChange={(key) => {
onSubmit?.(key as string)
diff --git a/src/frontend/src/locales/de/rooms.json b/src/frontend/src/locales/de/rooms.json
index 89aa08bc..28ae41a5 100644
--- a/src/frontend/src/locales/de/rooms.json
+++ b/src/frontend/src/locales/de/rooms.json
@@ -10,6 +10,7 @@
"join": {
"selectDevice": {
"loading": "Laden…",
+ "select": "Wählen Sie einen Wert",
"permissionsNeeded": "Genehmigung erforderlich"
},
"videoinput": {
diff --git a/src/frontend/src/locales/en/rooms.json b/src/frontend/src/locales/en/rooms.json
index e45611e4..8d5e3c6c 100644
--- a/src/frontend/src/locales/en/rooms.json
+++ b/src/frontend/src/locales/en/rooms.json
@@ -10,6 +10,7 @@
"join": {
"selectDevice": {
"loading": "Loading…",
+ "select": "Select a value",
"permissionsNeeded": "Permission needed"
},
"videoinput": {
diff --git a/src/frontend/src/locales/fr/rooms.json b/src/frontend/src/locales/fr/rooms.json
index 7ee191a7..636acfb1 100644
--- a/src/frontend/src/locales/fr/rooms.json
+++ b/src/frontend/src/locales/fr/rooms.json
@@ -10,6 +10,7 @@
"join": {
"selectDevice": {
"loading": "Chargement…",
+ "select": "Sélectionnez une valeur",
"permissionsNeeded": "Autorisations nécessaires"
},
"videoinput": {
diff --git a/src/frontend/src/locales/nl/rooms.json b/src/frontend/src/locales/nl/rooms.json
index 6659296b..f3e58120 100644
--- a/src/frontend/src/locales/nl/rooms.json
+++ b/src/frontend/src/locales/nl/rooms.json
@@ -10,6 +10,7 @@
"join": {
"selectDevice": {
"loading": "Bezig met laden…",
+ "select": "Selecteer een waarde",
"permissionsNeeded": "Toestemming vereist"
},
"videoinput": {