mirror of https://github.com/vector-im/riot-web
Revert voodoo
parent
4976cbb424
commit
0bafd6458a
|
@ -53,36 +53,12 @@ export default {
|
|||
// });
|
||||
},
|
||||
|
||||
_findDefault: function(devices) {
|
||||
return devices.some((device) => device.deviceId === 'default') ? 'default' : undefined;
|
||||
},
|
||||
|
||||
setAudioInputDefault: async function() {
|
||||
const devices = await this.getDevices();
|
||||
const audioDefault = this._findDefault(devices.audioinput);
|
||||
this._setAudioInput(audioDefault);
|
||||
},
|
||||
|
||||
setAudioInput: function(deviceId) {
|
||||
this[deviceId === 'default' ? 'setAudioInputDefault' : '_setAudioInput'](deviceId);
|
||||
},
|
||||
|
||||
_setAudioInput: function(deviceId) {
|
||||
UserSettingsStore.setLocalSetting('webrtc_audioinput', deviceId);
|
||||
Matrix.setMatrixCallAudioInput(deviceId);
|
||||
},
|
||||
|
||||
setVideoInputDefault: async function() {
|
||||
const devices = await this.getDevices();
|
||||
const videoDefault = this._findDefault(devices.videoinput);
|
||||
this._setVideoInput(videoDefault);
|
||||
},
|
||||
|
||||
setVideoInput: function(deviceId) {
|
||||
this[deviceId === 'default' ? 'setVideoInputDefault' : '_setVideoInput'](deviceId);
|
||||
},
|
||||
|
||||
_setVideoInput: function(deviceId) {
|
||||
UserSettingsStore.setLocalSetting('webrtc_videoinput', deviceId);
|
||||
Matrix.setMatrixCallVideoInput(deviceId);
|
||||
},
|
||||
|
|
|
@ -952,21 +952,24 @@ module.exports = React.createClass({
|
|||
let webcamDropdown = <p>{_t('No Webcams detected')}</p>;
|
||||
|
||||
const defaultOption = {
|
||||
deviceId: 'default',
|
||||
deviceId: undefined,
|
||||
label: _t('Default Device'),
|
||||
};
|
||||
|
||||
const audioInputs = this.state.mediaDevices.audioinput.slice(0);
|
||||
if (audioInputs.length > 0) {
|
||||
let defaultInput;
|
||||
if (!audioInputs.some((input) => input.deviceId === 'default')) {
|
||||
audioInputs.unshift(defaultOption);
|
||||
} else {
|
||||
defaultInput = 'default';
|
||||
}
|
||||
|
||||
microphoneDropdown = <div>
|
||||
<h4>{_t('Microphone')}</h4>
|
||||
<h4>Microphone</h4>
|
||||
<Dropdown
|
||||
className="mx_UserSettings_webRtcDevices_dropdown"
|
||||
value={this.state.activeAudioInput || 'default'}
|
||||
value={this.state.activeAudioInput || defaultInput}
|
||||
onOptionChange={this._setAudioInput}>
|
||||
{this._mapWebRtcDevicesToSpans(audioInputs)}
|
||||
</Dropdown>
|
||||
|
@ -975,15 +978,18 @@ module.exports = React.createClass({
|
|||
|
||||
const videoInputs = this.state.mediaDevices.videoinput.slice(0);
|
||||
if (videoInputs.length > 0) {
|
||||
let defaultInput;
|
||||
if (!videoInputs.some((input) => input.deviceId === 'default')) {
|
||||
videoInputs.unshift(defaultOption);
|
||||
} else {
|
||||
defaultInput = 'default';
|
||||
}
|
||||
|
||||
webcamDropdown = <div>
|
||||
<h4>{_t('Camera')}</h4>
|
||||
<h4>Cameras</h4>
|
||||
<Dropdown
|
||||
className="mx_UserSettings_webRtcDevices_dropdown"
|
||||
value={this.state.activeVideoInput || 'default'}
|
||||
value={this.state.activeVideoInput || defaultInput}
|
||||
onOptionChange={this._setVideoInput}>
|
||||
{this._mapWebRtcDevicesToSpans(videoInputs)}
|
||||
</Dropdown>
|
||||
|
|
|
@ -136,8 +136,6 @@
|
|||
"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",
|
||||
"Default Device": "Default Device",
|
||||
"Microphone": "Microphone",
|
||||
"Cameras": "Cameras",
|
||||
"Advanced": "Advanced",
|
||||
"Algorithm": "Algorithm",
|
||||
"Always show message timestamps": "Always show message timestamps",
|
||||
|
|
Loading…
Reference in New Issue