Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0bafd64

Browse files
committed
Revert voodoo
1 parent 4976cbb commit 0bafd64

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

src/CallMediaHandler.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,36 +53,12 @@ export default {
5353
// });
5454
},
5555

56-
_findDefault: function(devices) {
57-
return devices.some((device) => device.deviceId === 'default') ? 'default' : undefined;
58-
},
59-
60-
setAudioInputDefault: async function() {
61-
const devices = await this.getDevices();
62-
const audioDefault = this._findDefault(devices.audioinput);
63-
this._setAudioInput(audioDefault);
64-
},
65-
6656
setAudioInput: function(deviceId) {
67-
this[deviceId === 'default' ? 'setAudioInputDefault' : '_setAudioInput'](deviceId);
68-
},
69-
70-
_setAudioInput: function(deviceId) {
7157
UserSettingsStore.setLocalSetting('webrtc_audioinput', deviceId);
7258
Matrix.setMatrixCallAudioInput(deviceId);
7359
},
7460

75-
setVideoInputDefault: async function() {
76-
const devices = await this.getDevices();
77-
const videoDefault = this._findDefault(devices.videoinput);
78-
this._setVideoInput(videoDefault);
79-
},
80-
8161
setVideoInput: function(deviceId) {
82-
this[deviceId === 'default' ? 'setVideoInputDefault' : '_setVideoInput'](deviceId);
83-
},
84-
85-
_setVideoInput: function(deviceId) {
8662
UserSettingsStore.setLocalSetting('webrtc_videoinput', deviceId);
8763
Matrix.setMatrixCallVideoInput(deviceId);
8864
},

src/components/structures/UserSettings.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -952,21 +952,24 @@ module.exports = React.createClass({
952952
let webcamDropdown = <p>{_t('No Webcams detected')}</p>;
953953

954954
const defaultOption = {
955-
deviceId: 'default',
955+
deviceId: undefined,
956956
label: _t('Default Device'),
957957
};
958958

959959
const audioInputs = this.state.mediaDevices.audioinput.slice(0);
960960
if (audioInputs.length > 0) {
961+
let defaultInput;
961962
if (!audioInputs.some((input) => input.deviceId === 'default')) {
962963
audioInputs.unshift(defaultOption);
964+
} else {
965+
defaultInput = 'default';
963966
}
964967

965968
microphoneDropdown = <div>
966-
<h4>{_t('Microphone')}</h4>
969+
<h4>Microphone</h4>
967970
<Dropdown
968971
className="mx_UserSettings_webRtcDevices_dropdown"
969-
value={this.state.activeAudioInput || 'default'}
972+
value={this.state.activeAudioInput || defaultInput}
970973
onOptionChange={this._setAudioInput}>
971974
{this._mapWebRtcDevicesToSpans(audioInputs)}
972975
</Dropdown>
@@ -975,15 +978,18 @@ module.exports = React.createClass({
975978

976979
const videoInputs = this.state.mediaDevices.videoinput.slice(0);
977980
if (videoInputs.length > 0) {
981+
let defaultInput;
978982
if (!videoInputs.some((input) => input.deviceId === 'default')) {
979983
videoInputs.unshift(defaultOption);
984+
} else {
985+
defaultInput = 'default';
980986
}
981987

982988
webcamDropdown = <div>
983-
<h4>{_t('Camera')}</h4>
989+
<h4>Cameras</h4>
984990
<Dropdown
985991
className="mx_UserSettings_webRtcDevices_dropdown"
986-
value={this.state.activeVideoInput || 'default'}
992+
value={this.state.activeVideoInput || defaultInput}
987993
onOptionChange={this._setVideoInput}>
988994
{this._mapWebRtcDevicesToSpans(videoInputs)}
989995
</Dropdown>

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@
136136
"No media permissions": "No media permissions",
137137
"You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam",
138138
"Default Device": "Default Device",
139-
"Microphone": "Microphone",
140-
"Cameras": "Cameras",
141139
"Advanced": "Advanced",
142140
"Algorithm": "Algorithm",
143141
"Always show message timestamps": "Always show message timestamps",

0 commit comments

Comments
 (0)