From a35c9ea5853820e1d97c58a84b796bce0c7f390d Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 17 Jun 2019 19:36:52 +0200 Subject: [PATCH] provide default for missing device labels --- src/CallMediaHandler.js | 2 -- .../views/settings/tabs/user/VoiceUserSettingsTab.js | 12 +++++++++++- src/i18n/strings/en_EN.json | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js index 9a1c9d70b8..55b8764a9e 100644 --- a/src/CallMediaHandler.js +++ b/src/CallMediaHandler.js @@ -26,8 +26,6 @@ export default { const audioinput = []; const videoinput = []; - if (devices.some((device) => !device.label)) return false; - devices.forEach((device) => { switch (device.kind) { case 'audiooutput': audiooutput.push(device); break; diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js index 84d70a48d4..31a11b13ea 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js @@ -100,7 +100,17 @@ export default class VoiceUserSettingsTab extends React.Component { }; _renderDeviceOptions(devices, category) { - return devices.map((d) => ); + return devices.map((d) => { + let label = d.label; + if (!label) { + switch (d.kind) { + case "audioinput": label = _t("Unnamed microphone"); break; + case "audiooutput": label = _t("Unnamed audio output"); break; + case "videoinput": label = _t("Unnamed camera"); break; + } + } + return (); + }); } render() { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 53fd82f6f2..07f362441c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -610,6 +610,9 @@ "Learn more about how we use analytics.": "Learn more about how we use analytics.", "No media permissions": "No media permissions", "You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam", + "Unnamed microphone": "Unnamed microphone", + "Unnamed audio output": "Unnamed audio output", + "Unnamed camera": "Unnamed camera", "Missing media permissions, click the button below to request.": "Missing media permissions, click the button below to request.", "Request media permissions": "Request media permissions", "No Audio Outputs detected": "No Audio Outputs detected",