bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx

41 lines
1.4 KiB
React
Raw Normal View History

2017-09-29 21:38:10 +08:00
import React from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import { withModalMounter } from '/imports/ui/components/modal/service';
import AudioModal from './component';
import Service from '../service';
const AudioModalContainer = props => <AudioModal {...props} />;
2017-09-29 21:42:08 +08:00
export default withModalMounter(createContainer(({ mountModal }) =>
({
closeModal: () => {
if (!Service.isConnecting()) mountModal(null);
},
2017-10-18 03:16:42 +08:00
joinMicrophone: () =>
new Promise((resolve, reject) => {
Service.transferCall().then(() => {
mountModal(null);
resolve();
}).catch(() => {
Service.exitAudio();
reject();
});
2017-10-18 03:16:42 +08:00
}),
joinListenOnly: () => Service.joinListenOnly().then(() => mountModal(null)),
2017-10-05 04:49:11 +08:00
leaveEchoTest: () => {
if (!Service.isEchoTest()) {
return Promise.resolve();
}
return Service.exitAudio();
2017-09-29 21:42:08 +08:00
},
changeInputDevice: inputDeviceId => Service.changeInputDevice(inputDeviceId),
changeOutputDevice: outputDeviceId => Service.changeOutputDevice(outputDeviceId),
2017-09-29 21:42:08 +08:00
joinEchoTest: () => Service.joinEchoTest(),
exitAudio: () => Service.exitAudio(),
isConnecting: Service.isConnecting(),
isConnected: Service.isConnected(),
isEchoTest: Service.isEchoTest(),
2017-10-04 04:42:10 +08:00
inputDeviceId: Service.inputDeviceId(),
outputDeviceId: Service.outputDeviceId(),
2017-09-29 21:42:08 +08:00
}), AudioModalContainer));