2016-11-16 05:00:28 +08:00
|
|
|
import React from 'react';
|
2017-04-07 20:44:05 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2016-11-16 05:00:28 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2017-05-03 01:18:01 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
2016-12-09 02:17:08 +08:00
|
|
|
import DeviceSelector from '/imports/ui/components/audio/device-selector/component';
|
|
|
|
import AudioStreamVolume from '/imports/ui/components/audio/audio-stream-volume/component';
|
2017-03-28 22:02:23 +08:00
|
|
|
import EnterAudioContainer from '/imports/ui/components/audio/enter-audio/container';
|
2017-03-23 21:19:44 +08:00
|
|
|
import AudioTestContainer from '/imports/ui/components/audio/audio-test/container';
|
2017-03-23 04:10:49 +08:00
|
|
|
import cx from 'classnames';
|
2017-09-26 04:28:36 +08:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
backLabel: {
|
|
|
|
id: 'app.audio.backLabel',
|
|
|
|
description: 'audio settings back button label',
|
|
|
|
},
|
|
|
|
titleLabel: {
|
|
|
|
id: 'app.audio.audioSettings.titleLabel',
|
|
|
|
description: 'audio setting title 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',
|
|
|
|
},
|
2017-10-05 04:49:11 +08:00
|
|
|
retryLabel: {
|
|
|
|
id: 'app.audio.audioSettings.retryLabel',
|
|
|
|
description: 'Retry button label',
|
2017-09-29 21:38:10 +08:00
|
|
|
},
|
2017-09-26 04:28:36 +08:00
|
|
|
});
|
2016-12-01 11:37:52 +08:00
|
|
|
|
2017-02-17 04:57:57 +08:00
|
|
|
class AudioSettings extends React.Component {
|
2016-11-16 05:00:28 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.chooseAudio = this.chooseAudio.bind(this);
|
2016-12-09 02:17:08 +08:00
|
|
|
this.handleInputChange = this.handleInputChange.bind(this);
|
|
|
|
this.handleOutputChange = this.handleOutputChange.bind(this);
|
2017-09-26 04:28:36 +08:00
|
|
|
this.handleBack = props.handleBack;
|
2017-10-05 04:49:11 +08:00
|
|
|
this.handleRetry = props.handleRetry;
|
2017-09-29 21:38:10 +08:00
|
|
|
this.exitAudio = props.exitAudio;
|
2017-09-30 04:42:34 +08:00
|
|
|
this.changeInputDevice = props.changeInputDevice;
|
2017-10-10 04:48:10 +08:00
|
|
|
this.changeOutputDevice = props.changeOutputDevice;
|
2017-10-04 04:42:10 +08:00
|
|
|
|
|
|
|
console.log('inputDeviceId', props.inputDeviceId);
|
2016-12-09 02:17:08 +08:00
|
|
|
this.state = {
|
2017-10-04 04:42:10 +08:00
|
|
|
inputDeviceId: props.inputDeviceId,
|
2017-09-26 04:28:36 +08:00
|
|
|
outputDeviceId: undefined,
|
2017-03-23 04:10:49 +08:00
|
|
|
};
|
2016-11-22 05:06:19 +08:00
|
|
|
}
|
|
|
|
|
2016-11-16 05:00:28 +08:00
|
|
|
chooseAudio() {
|
|
|
|
this.props.changeMenu(this.props.JOIN_AUDIO);
|
|
|
|
}
|
|
|
|
|
2017-09-30 04:42:34 +08:00
|
|
|
handleInputChange(deviceId, device) {
|
2016-12-09 02:17:08 +08:00
|
|
|
console.log(`INPUT DEVICE CHANGED: ${deviceId}`);
|
2017-09-30 04:42:34 +08:00
|
|
|
console.log(device);
|
|
|
|
this.changeInputDevice(deviceId);
|
2016-12-09 02:17:08 +08:00
|
|
|
this.setState({
|
2017-03-23 04:10:49 +08:00
|
|
|
inputDeviceId: deviceId,
|
2016-12-09 02:17:08 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-09-29 21:38:10 +08:00
|
|
|
handleOutputChange(deviceId, device) {
|
2016-12-09 02:17:08 +08:00
|
|
|
console.log(`OUTPUT DEVICE CHANGED: ${deviceId}`);
|
2017-09-30 04:42:34 +08:00
|
|
|
console.log(device);
|
2017-10-10 04:48:10 +08:00
|
|
|
this.changeOutputDevice(deviceId);
|
2017-09-26 04:28:36 +08:00
|
|
|
this.setState({
|
|
|
|
outputDeviceId: deviceId,
|
|
|
|
});
|
2016-12-09 02:17:08 +08:00
|
|
|
}
|
|
|
|
|
2017-09-29 21:38:10 +08:00
|
|
|
// handleClose() {
|
|
|
|
// this.setState({ isOpen: false });
|
|
|
|
// this.props.mountModal(null);
|
|
|
|
// }
|
2016-12-21 05:30:23 +08:00
|
|
|
|
2016-11-16 05:00:28 +08:00
|
|
|
render() {
|
2017-02-17 04:57:57 +08:00
|
|
|
const {
|
2017-09-29 21:38:10 +08:00
|
|
|
isConnecting,
|
2017-02-17 04:57:57 +08:00
|
|
|
intl,
|
|
|
|
} = this.props;
|
|
|
|
|
2017-09-29 21:38:10 +08:00
|
|
|
// return this.renderCalling();
|
2016-11-16 05:00:28 +08:00
|
|
|
return (
|
|
|
|
<div>
|
2017-03-23 04:10:49 +08:00
|
|
|
<div className={styles.form}>
|
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.audioNote}>
|
2017-04-07 20:44:05 +08:00
|
|
|
{intl.formatMessage(intlMessages.descriptionLabel)}
|
2017-03-23 04:10:49 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<div className={styles.formElement}>
|
|
|
|
<label className={cx(styles.label, styles.labelSmall)}>
|
2017-04-07 20:44:05 +08:00
|
|
|
{intl.formatMessage(intlMessages.micSourceLabel)}
|
2017-07-06 23:54:18 +08:00
|
|
|
<DeviceSelector
|
|
|
|
value={this.state.inputDeviceId}
|
|
|
|
className={styles.select}
|
|
|
|
kind="audioinput"
|
|
|
|
onChange={this.handleInputChange}
|
|
|
|
/>
|
2017-03-23 04:10:49 +08:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<div className={styles.formElement}>
|
|
|
|
<label className={cx(styles.label, styles.labelSmall)}>
|
2017-04-07 20:44:05 +08:00
|
|
|
{intl.formatMessage(intlMessages.speakerSourceLabel)}
|
2017-07-06 23:54:18 +08:00
|
|
|
<DeviceSelector
|
|
|
|
value={this.state.outputDeviceId}
|
|
|
|
className={styles.select}
|
|
|
|
kind="audiooutput"
|
|
|
|
onChange={this.handleOutputChange}
|
|
|
|
/>
|
2017-03-23 04:10:49 +08:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<div className={styles.formElement}>
|
|
|
|
<label className={cx(styles.label, styles.labelSmall)}>
|
2017-09-20 01:47:57 +08:00
|
|
|
{intl.formatMessage(intlMessages.streamVolumeLabel)}
|
2017-07-06 23:54:18 +08:00
|
|
|
<AudioStreamVolume
|
|
|
|
deviceId={this.state.inputDeviceId}
|
|
|
|
className={styles.audioMeter}
|
|
|
|
/>
|
2017-03-23 04:10:49 +08:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.col}>
|
2017-10-10 04:48:10 +08:00
|
|
|
<label className={styles.labelSmall}>
|
|
|
|
Test your speaker volume
|
|
|
|
<AudioTestContainer />
|
|
|
|
</label>
|
2017-03-23 04:10:49 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-16 05:00:28 +08:00
|
|
|
</div>
|
2017-03-23 04:10:49 +08:00
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
|
2017-03-23 04:10:49 +08:00
|
|
|
<div className={styles.enterAudio}>
|
2017-09-26 04:28:36 +08:00
|
|
|
<Button
|
|
|
|
className={styles.backBtn}
|
|
|
|
label={intl.formatMessage(intlMessages.backLabel)}
|
|
|
|
size={'md'}
|
|
|
|
color={'primary'}
|
|
|
|
onClick={this.handleBack}
|
2017-09-29 21:38:10 +08:00
|
|
|
disabled={isConnecting}
|
|
|
|
ghost
|
2017-09-26 04:28:36 +08:00
|
|
|
/>
|
2017-09-29 21:38:10 +08:00
|
|
|
<Button
|
|
|
|
size={'md'}
|
|
|
|
color={'primary'}
|
2017-10-05 04:49:11 +08:00
|
|
|
label={intl.formatMessage(intlMessages.retryLabel)}
|
|
|
|
onClick={this.handleRetry}
|
|
|
|
/>
|
2016-11-16 05:00:28 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-09-29 21:42:08 +08:00
|
|
|
);
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
2017-09-29 21:38:10 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-02-17 04:57:57 +08:00
|
|
|
|
2017-05-03 01:18:01 +08:00
|
|
|
export default withModalMounter(injectIntl(AudioSettings));
|