import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, intlShape } from 'react-intl'; import Button from '/imports/ui/components/button/component'; import { withModalMounter } from '/imports/ui/components/modal/service'; import DeviceSelector from '/imports/ui/components/audio/device-selector/component'; import AudioStreamVolume from '/imports/ui/components/audio/audio-stream-volume/component'; import AudioTestContainer from '/imports/ui/components/audio/audio-test/container'; import cx from 'classnames'; import styles from './styles'; const propTypes = { intl: intlShape.isRequired, exitAudio: PropTypes.func.isRequired, changeInputDevice: PropTypes.func.isRequired, changeOutputDevice: PropTypes.func.isRequired, handleBack: PropTypes.func.isRequired, handleRetry: PropTypes.func.isRequired, isConnecting: PropTypes.bool.isRequired, inputDeviceId: PropTypes.string.isRequired, outputDeviceId: PropTypes.string.isRequired, }; const intlMessages = defineMessages({ backLabel: { id: 'app.audio.backLabel', description: 'audio settings back button label', }, descriptionLabel: { id: 'app.audio.audioSettings.descriptionLabel', description: 'audio settings description label', }, micSourceLabel: { id: 'app.audio.audioSettings.microphoneSourceLabel', description: 'Label for mic source', }, speakerSourceLabel: { id: 'app.audio.audioSettings.speakerSourceLabel', description: 'Label for speaker source', }, streamVolumeLabel: { id: 'app.audio.audioSettings.microphoneStreamLabel', description: 'Label for stream volume', }, retryLabel: { id: 'app.audio.audioSettings.retryLabel', description: 'Retry button label', }, }); class AudioSettings extends React.Component { constructor(props) { super(props); const { handleBack, handleRetry, exitAudio, changeInputDevice, changeOutputDevice, } = props; this.handleInputChange = this.handleInputChange.bind(this); this.handleOutputChange = this.handleOutputChange.bind(this); this.handleBack = handleBack; this.handleRetry = handleRetry; this.exitAudio = exitAudio; this.changeInputDevice = changeInputDevice; this.changeOutputDevice = changeOutputDevice; this.state = { inputDeviceId: props.inputDeviceId, outputDeviceId: props.outputDeviceId, }; } handleInputChange(deviceId, device) { console.log(`INPUT DEVICE CHANGED: ${deviceId}`); console.log(device); this.changeInputDevice(deviceId); this.setState({ inputDeviceId: deviceId, }); } handleOutputChange(deviceId, device) { console.log(`OUTPUT DEVICE CHANGED: ${deviceId}`); console.log(device); this.changeOutputDevice(deviceId); this.setState({ outputDeviceId: deviceId, }); } render() { const { isConnecting, intl, } = this.props; return (