2017-06-28 06:14:53 +08:00
|
|
|
import Users from '/imports/api/2.0/users';
|
2017-04-19 23:01:28 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-03-28 22:02:23 +08:00
|
|
|
|
2017-06-19 19:57:32 +08:00
|
|
|
import AudioManager from '/imports/api/1.1/audio/client/manager';
|
2017-03-28 22:02:23 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
let audioManager;
|
2017-04-19 22:59:57 +08:00
|
|
|
const init = () => {
|
2017-04-19 23:01:28 +08:00
|
|
|
const userId = Auth.userID;
|
|
|
|
const User = Users.findOne({ userId });
|
|
|
|
const username = User.user.name;
|
|
|
|
|
2017-07-13 02:51:29 +08:00
|
|
|
const turns = [];
|
|
|
|
const stuns = [];
|
|
|
|
// FIX ME
|
|
|
|
const voiceBridge = 'Meeting.voiceConf';
|
|
|
|
// FIX ME
|
|
|
|
const microphoneLockEnforced = 'Meeting.roomLockSettings.disableMic';
|
2017-04-19 22:59:57 +08:00
|
|
|
|
2017-04-19 23:01:28 +08:00
|
|
|
const userData = {
|
|
|
|
userId,
|
|
|
|
username,
|
|
|
|
turns,
|
|
|
|
stuns,
|
|
|
|
voiceBridge,
|
2017-05-04 04:12:47 +08:00
|
|
|
microphoneLockEnforced,
|
2017-04-19 23:01:28 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
audioManager = new AudioManager(userData);
|
|
|
|
};
|
2017-04-19 22:59:57 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const exitAudio = () => audioManager.exitAudio();
|
|
|
|
const joinListenOnly = () => audioManager.joinAudio(true);
|
|
|
|
const joinMicrophone = () => audioManager.joinAudio(false);
|
2017-03-31 01:57:05 +08:00
|
|
|
|
2017-05-03 01:18:01 +08:00
|
|
|
export default {
|
2017-04-19 22:59:57 +08:00
|
|
|
init,
|
2017-03-28 22:02:23 +08:00
|
|
|
exitAudio,
|
|
|
|
joinListenOnly,
|
|
|
|
joinMicrophone,
|
2017-03-28 04:40:44 +08:00
|
|
|
};
|