Prevent empty device labels in audio preview
Fixes: #324 Signed-off-by: Johannes Marbach <johannesm@element.io>
This commit is contained in:
parent
4dcec504ca
commit
e8d99e15f7
1 changed files with 12 additions and 4 deletions
|
@ -53,8 +53,12 @@ export function AudioPreview({
|
||||||
onSelectionChange={setAudioInput}
|
onSelectionChange={setAudioInput}
|
||||||
className={styles.inputField}
|
className={styles.inputField}
|
||||||
>
|
>
|
||||||
{audioInputs.map(({ deviceId, label }) => (
|
{audioInputs.map(({ deviceId, label }, index) => (
|
||||||
<Item key={deviceId}>{label}</Item>
|
<Item key={deviceId}>
|
||||||
|
{!!label && label.trim().length > 0
|
||||||
|
? label
|
||||||
|
: `Microphone ${index + 1}`}
|
||||||
|
</Item>
|
||||||
))}
|
))}
|
||||||
</SelectInput>
|
</SelectInput>
|
||||||
{audioOutputs.length > 0 && (
|
{audioOutputs.length > 0 && (
|
||||||
|
@ -64,8 +68,12 @@ export function AudioPreview({
|
||||||
onSelectionChange={setAudioOutput}
|
onSelectionChange={setAudioOutput}
|
||||||
className={styles.inputField}
|
className={styles.inputField}
|
||||||
>
|
>
|
||||||
{audioOutputs.map(({ deviceId, label }) => (
|
{audioOutputs.map(({ deviceId, label }, index) => (
|
||||||
<Item key={deviceId}>{label}</Item>
|
<Item key={deviceId}>
|
||||||
|
{!!label && label.trim().length > 0
|
||||||
|
? label
|
||||||
|
: `Speaker ${index + 1}`}
|
||||||
|
</Item>
|
||||||
))}
|
))}
|
||||||
</SelectInput>
|
</SelectInput>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue