Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { all, find } from 'ramda';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
Expand Down Expand Up @@ -53,12 +54,18 @@ export default class AudioSettingsPanel extends Component {
callVolume: newProps.callVolume,
});
}
if (newProps.inputDeviceId !== this.props.inputDeviceId) {
if (newProps.inputDeviceId !== this.props.inputDeviceId || all(
device => device.deviceId !== this.state.inputDeviceId,
newProps.availableInputDevices
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we validate and update inputDeviceId when availableInputDevices are changed in audio setting module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inputDeviceId from AudioSetting module is correct. The code is to correct the component inputDeviceId state itself.

)) {
this.setState({
inputDeviceId: newProps.inputDeviceId,
});
}
if (newProps.outputDeviceId !== this.props.outputDeviceId) {
if (newProps.outputDeviceId !== this.props.outputDeviceId || all(
device => device.deviceId !== this.state.outputDeviceId,
newProps.availableOutputDevices
)) {
this.setState({
outputDeviceId: newProps.outputDeviceId,
});
Expand Down Expand Up @@ -148,13 +155,17 @@ export default class AudioSettingsPanel extends Component {
return device.deviceId;
}
renderOutputDevice = (value) => {
const device = this.props.availableOutputDevices
.find(device => device.deviceId === value);
const device = find(
device => device.deviceId === value,
this.props.availableOutputDevices
);
return device && device.label || value;
}
renderInputDevice = (value) => {
const device = this.props.availableInputDevices
.find(device => device.deviceId === value);
const device = find(
device => device.deviceId === value,
this.props.availableInputDevices
);
return device && device.label || value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ function mapToFunctions(_, {
},
}) {
return {
onBackButtonClick: () => {
onBackButtonClick() {
routerInteraction.goBack();
},
onSave: (data) => {
onSave(data) {
audioSettings.setData(data);
},
checkUserMedia: () => {
checkUserMedia() {
audioSettings.getUserMedia();
},
};
Expand Down