2016-11-16 05:00:28 +08:00
|
|
|
import React from 'react';
|
2017-02-17 04:57:57 +08:00
|
|
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
2016-11-16 05:00:28 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
import { clearModal } from '/imports/ui/components/app/service';
|
2017-03-25 00:01:35 +08:00
|
|
|
import styles from '../audio-modal/styles.scss';
|
2016-11-16 05:00:28 +08:00
|
|
|
|
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';
|
2016-12-06 09:37:46 +08:00
|
|
|
import EnterAudioContainer from '/imports/ui/components/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';
|
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);
|
2016-12-21 05:30:23 +08:00
|
|
|
this.handleClose = this.handleClose.bind(this);
|
2016-12-09 02:17:08 +08:00
|
|
|
|
|
|
|
this.state = {
|
|
|
|
inputDeviceId: 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);
|
|
|
|
}
|
|
|
|
|
2016-12-09 02:17:08 +08:00
|
|
|
handleInputChange(deviceId) {
|
|
|
|
console.log(`INPUT DEVICE CHANGED: ${deviceId}`);
|
|
|
|
this.setState({
|
2017-03-23 04:10:49 +08:00
|
|
|
inputDeviceId: deviceId,
|
2016-12-09 02:17:08 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
handleOutputChange(deviceId) {
|
|
|
|
console.log(`OUTPUT DEVICE CHANGED: ${deviceId}`);
|
|
|
|
}
|
|
|
|
|
2016-12-21 05:30:23 +08:00
|
|
|
handleClose() {
|
|
|
|
this.setState({ isOpen: false });
|
|
|
|
clearModal();
|
|
|
|
}
|
|
|
|
|
2016-11-16 05:00:28 +08:00
|
|
|
render() {
|
2017-02-17 04:57:57 +08:00
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
} = this.props;
|
|
|
|
|
2016-11-16 05:00:28 +08:00
|
|
|
return (
|
|
|
|
<div>
|
2017-03-23 04:10:49 +08:00
|
|
|
<div className={styles.topRow}>
|
2016-11-16 05:00:28 +08:00
|
|
|
<Button className={styles.backBtn}
|
2017-02-17 04:57:57 +08:00
|
|
|
label={intl.formatMessage(intlMessages.backLabel)}
|
2017-03-02 09:03:02 +08:00
|
|
|
icon={'left_arrow'}
|
2016-11-16 05:00:28 +08:00
|
|
|
size={'md'}
|
|
|
|
color={'primary'}
|
|
|
|
ghost={true}
|
|
|
|
onClick={this.chooseAudio}
|
|
|
|
/>
|
2017-03-24 06:50:30 +08:00
|
|
|
<div className={cx(styles.title, styles.chooseAudio)}>
|
2017-02-17 04:57:57 +08:00
|
|
|
<FormattedMessage
|
|
|
|
id="app.audio.audioSettings.titleLabel"
|
|
|
|
/>
|
2016-11-16 05:00:28 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-03-23 04:10:49 +08:00
|
|
|
|
|
|
|
<div className={styles.form}>
|
|
|
|
|
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.audioNote}>
|
|
|
|
<FormattedMessage
|
|
|
|
id="app.audio.audioSettings.descriptionLabel"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<div className={styles.formElement}>
|
|
|
|
<label className={cx(styles.label, styles.labelSmall)}>
|
|
|
|
Microphone source
|
|
|
|
</label>
|
|
|
|
<DeviceSelector
|
|
|
|
value={this.state.inputDeviceId}
|
|
|
|
className={styles.select}
|
|
|
|
kind="audioinput"
|
|
|
|
onChange={this.handleInputChange} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<div className={styles.formElement}>
|
|
|
|
<label className={cx(styles.label, styles.labelSmall)}>
|
|
|
|
Speaker source
|
|
|
|
</label>
|
|
|
|
<DeviceSelector
|
|
|
|
value={this.state.outputDeviceId}
|
|
|
|
className={styles.select}
|
|
|
|
kind="audiooutput"
|
|
|
|
onChange={this.handleOutputChange} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.row}>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<div className={styles.formElement}>
|
|
|
|
<label className={cx(styles.label, styles.labelSmall)}>
|
|
|
|
Your audio stream volume
|
|
|
|
</label>
|
|
|
|
<AudioStreamVolume
|
|
|
|
deviceId={this.state.inputDeviceId}
|
|
|
|
className={styles.audioMeter} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.col}>
|
|
|
|
<label className={styles.label}> </label>
|
|
|
|
<AudioTestContainer/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-16 05:00:28 +08:00
|
|
|
</div>
|
2017-03-23 04:10:49 +08:00
|
|
|
|
|
|
|
<div className={styles.enterAudio}>
|
2016-12-06 09:37:46 +08:00
|
|
|
<EnterAudioContainer isFullAudio={true}/>
|
2016-11-16 05:00:28 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
2017-02-17 04:57:57 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
backLabel: {
|
|
|
|
id: 'app.audio.backLabel',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default injectIntl(AudioSettings);
|