2016-11-16 05:00:28 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
2017-02-15 00:28:21 +08:00
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2017-07-24 22:15:46 +08:00
|
|
|
import AudioManager from '/imports/api/2.0/audio/client/manager';
|
2016-11-16 05:00:28 +08:00
|
|
|
|
2017-02-15 00:28:21 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
joinAudio: {
|
|
|
|
id: 'app.audio.joinAudio',
|
2017-04-20 04:52:50 +08:00
|
|
|
description: 'Join audio button label',
|
2017-02-15 00:28:21 +08:00
|
|
|
},
|
|
|
|
leaveAudio: {
|
|
|
|
id: 'app.audio.leaveAudio',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Leave audio button label',
|
2017-04-11 22:07:49 +08:00
|
|
|
},
|
2017-02-15 00:28:21 +08:00
|
|
|
});
|
2016-11-16 05:00:28 +08:00
|
|
|
|
2017-02-15 00:28:21 +08:00
|
|
|
class JoinAudioOptions extends React.Component {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
isInAudio,
|
|
|
|
isInListenOnly,
|
2017-03-15 06:34:57 +08:00
|
|
|
handleJoinAudio,
|
|
|
|
handleCloseAudio,
|
2017-02-15 00:28:21 +08:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (isInAudio || isInListenOnly) {
|
2017-06-28 06:41:56 +08:00
|
|
|
if (AudioManager.currentState == AudioManager.callStates.inConference ||
|
|
|
|
AudioManager.currentState == AudioManager.callStates.inListenOnly) {
|
2017-06-23 05:31:27 +08:00
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
onClick={handleCloseAudio}
|
|
|
|
label={intl.formatMessage(intlMessages.leaveAudio)}
|
|
|
|
color={'danger'}
|
|
|
|
icon={'audio_off'}
|
|
|
|
size={'lg'}
|
|
|
|
circle
|
|
|
|
/>
|
|
|
|
);
|
2017-06-28 06:41:56 +08:00
|
|
|
}
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
2016-11-19 05:24:59 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
2017-03-15 06:34:57 +08:00
|
|
|
onClick={handleJoinAudio}
|
2017-02-15 00:28:21 +08:00
|
|
|
label={intl.formatMessage(intlMessages.joinAudio)}
|
2016-11-19 05:24:59 +08:00
|
|
|
color={'primary'}
|
2017-03-02 09:03:02 +08:00
|
|
|
icon={'audio_on'}
|
2016-11-19 05:24:59 +08:00
|
|
|
size={'lg'}
|
2017-06-03 03:25:02 +08:00
|
|
|
circle
|
2016-11-19 05:24:59 +08:00
|
|
|
/>
|
|
|
|
);
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
|
|
|
}
|
2017-02-15 00:28:21 +08:00
|
|
|
|
|
|
|
export default withRouter(injectIntl(JoinAudioOptions));
|