this is just endless

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-06-01 23:54:17 +01:00
parent beedeec163
commit 3eb519b227

View file

@ -958,14 +958,18 @@ module.exports = React.createClass({
const audioInputs = this.state.mediaDevices.audioinput.slice(0); const audioInputs = this.state.mediaDevices.audioinput.slice(0);
if (audioInputs.length > 0) { if (audioInputs.length > 0) {
let defaultInput;
if (!audioInputs.some((input) => input.deviceId === 'default')) { if (!audioInputs.some((input) => input.deviceId === 'default')) {
audioInputs.unshift(defaultOption); audioInputs.unshift(defaultOption);
} else {
defaultInput = 'default';
} }
microphoneDropdown = <div> microphoneDropdown = <div>
<h4>Microphone</h4> <h4>Microphone</h4>
<Dropdown <Dropdown
className="mx_UserSettings_webRtcDevices_dropdown" className="mx_UserSettings_webRtcDevices_dropdown"
value={this.state.activeAudioInput} value={this.state.activeAudioInput || defaultInput}
onOptionChange={this._setAudioInput}> onOptionChange={this._setAudioInput}>
{this._mapWebRtcDevicesToSpans(audioInputs)} {this._mapWebRtcDevicesToSpans(audioInputs)}
</Dropdown> </Dropdown>
@ -974,14 +978,18 @@ module.exports = React.createClass({
const videoInputs = this.state.mediaDevices.videoinput.slice(0); const videoInputs = this.state.mediaDevices.videoinput.slice(0);
if (videoInputs.length > 0) { if (videoInputs.length > 0) {
let defaultInput;
if (!videoInputs.some((input) => input.deviceId === 'default')) { if (!videoInputs.some((input) => input.deviceId === 'default')) {
videoInputs.unshift(defaultOption); videoInputs.unshift(defaultOption);
} else {
defaultInput = 'default';
} }
webcamDropdown = <div> webcamDropdown = <div>
<h4>Cameras</h4> <h4>Cameras</h4>
<Dropdown <Dropdown
className="mx_UserSettings_webRtcDevices_dropdown" className="mx_UserSettings_webRtcDevices_dropdown"
value={this.state.activeVideoInput} value={this.state.activeVideoInput || defaultInput}
onOptionChange={this._setVideoInput}> onOptionChange={this._setVideoInput}>
{this._mapWebRtcDevicesToSpans(videoInputs)} {this._mapWebRtcDevicesToSpans(videoInputs)}
</Dropdown> </Dropdown>