provide default for missing device labels

pull/21833/head
Bruno Windels 2019-06-17 19:36:52 +02:00
parent 2eef3d610e
commit a35c9ea585
3 changed files with 14 additions and 3 deletions

View File

@ -26,8 +26,6 @@ export default {
const audioinput = []; const audioinput = [];
const videoinput = []; const videoinput = [];
if (devices.some((device) => !device.label)) return false;
devices.forEach((device) => { devices.forEach((device) => {
switch (device.kind) { switch (device.kind) {
case 'audiooutput': audiooutput.push(device); break; case 'audiooutput': audiooutput.push(device); break;

View File

@ -100,7 +100,17 @@ export default class VoiceUserSettingsTab extends React.Component {
}; };
_renderDeviceOptions(devices, category) { _renderDeviceOptions(devices, category) {
return devices.map((d) => <option key={`${category}-${d.deviceId}`} value={d.deviceId}>{d.label}</option>); 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 (<option key={`${category}-${d.deviceId}`} value={d.deviceId}>{label}</option>);
});
} }
render() { render() {

View File

@ -610,6 +610,9 @@
"Learn more about how we use analytics.": "Learn more about how we use analytics.", "Learn more about how we use analytics.": "Learn more about how we use analytics.",
"No media permissions": "No media permissions", "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", "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.", "Missing media permissions, click the button below to request.": "Missing media permissions, click the button below to request.",
"Request media permissions": "Request media permissions", "Request media permissions": "Request media permissions",
"No Audio Outputs detected": "No Audio Outputs detected", "No Audio Outputs detected": "No Audio Outputs detected",