Skip to content

Commit 4dcec50

Browse files
authored
Merge pull request #449 from Johennes/feature/no-empty-labels
Prevent empty device labels
2 parents c6030d3 + 1308e52 commit 4dcec50

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/settings/SettingsModal.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ export const SettingsModal = (props: Props) => {
7777
selectedKey={audioInput}
7878
onSelectionChange={setAudioInput}
7979
>
80-
{audioInputs.map(({ deviceId, label }) => (
81-
<Item key={deviceId}>{label}</Item>
80+
{audioInputs.map(({ deviceId, label }, index) => (
81+
<Item key={deviceId}>
82+
{!!label && label.trim().length > 0
83+
? label
84+
: `Microphone ${index + 1}`}
85+
</Item>
8286
))}
8387
</SelectInput>
8488
{audioOutputs.length > 0 && (
@@ -87,8 +91,12 @@ export const SettingsModal = (props: Props) => {
8791
selectedKey={audioOutput}
8892
onSelectionChange={setAudioOutput}
8993
>
90-
{audioOutputs.map(({ deviceId, label }) => (
91-
<Item key={deviceId}>{label}</Item>
94+
{audioOutputs.map(({ deviceId, label }, index) => (
95+
<Item key={deviceId}>
96+
{!!label && label.trim().length > 0
97+
? label
98+
: `Speaker ${index + 1}`}
99+
</Item>
92100
))}
93101
</SelectInput>
94102
)}
@@ -118,8 +126,12 @@ export const SettingsModal = (props: Props) => {
118126
selectedKey={videoInput}
119127
onSelectionChange={setVideoInput}
120128
>
121-
{videoInputs.map(({ deviceId, label }) => (
122-
<Item key={deviceId}>{label}</Item>
129+
{videoInputs.map(({ deviceId, label }, index) => (
130+
<Item key={deviceId}>
131+
{!!label && label.trim().length > 0
132+
? label
133+
: `Camera ${index + 1}`}
134+
</Item>
123135
))}
124136
</SelectInput>
125137
</TabItem>

0 commit comments

Comments
 (0)