Merge pull request #449 from Johennes/feature/no-empty-labels

Prevent empty device labels
This commit is contained in:
David Baker 2022-07-07 12:16:18 +01:00 committed by GitHub
commit 4dcec504ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,8 +77,12 @@ export const SettingsModal = (props: Props) => {
selectedKey={audioInput}
onSelectionChange={setAudioInput}
>
{audioInputs.map(({ deviceId, label }) => (
<Item key={deviceId}>{label}</Item>
{audioInputs.map(({ deviceId, label }, index) => (
<Item key={deviceId}>
{!!label && label.trim().length > 0
? label
: `Microphone ${index + 1}`}
</Item>
))}
</SelectInput>
{audioOutputs.length > 0 && (
@ -87,8 +91,12 @@ export const SettingsModal = (props: Props) => {
selectedKey={audioOutput}
onSelectionChange={setAudioOutput}
>
{audioOutputs.map(({ deviceId, label }) => (
<Item key={deviceId}>{label}</Item>
{audioOutputs.map(({ deviceId, label }, index) => (
<Item key={deviceId}>
{!!label && label.trim().length > 0
? label
: `Speaker ${index + 1}`}
</Item>
))}
</SelectInput>
)}
@ -118,8 +126,12 @@ export const SettingsModal = (props: Props) => {
selectedKey={videoInput}
onSelectionChange={setVideoInput}
>
{videoInputs.map(({ deviceId, label }) => (
<Item key={deviceId}>{label}</Item>
{videoInputs.map(({ deviceId, label }, index) => (
<Item key={deviceId}>
{!!label && label.trim().length > 0
? label
: `Camera ${index + 1}`}
</Item>
))}
</SelectInput>
</TabItem>