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