bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/service.js

36 lines
882 B
JavaScript
Raw Normal View History

import Users from '/imports/api/2.0/users';
2017-04-19 23:01:28 +08:00
import Auth from '/imports/ui/services/auth';
2017-08-01 04:54:18 +08:00
import AudioManager from '/imports/api/2.0/audio/client/manager';
2017-07-18 22:59:05 +08:00
import Meetings from '/imports/api/2.0/meetings';
2017-03-28 22:02:23 +08:00
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 });
2017-07-26 22:31:35 +08:00
const username = User.name;
2017-07-18 22:59:05 +08:00
const Meeting = Meetings.findOne({ meetingId: User.meetingId });
const voiceBridge = Meeting.voiceProp.voiceConf;
2017-04-19 23:01:28 +08:00
// FIX ME
2017-07-18 22:59:05 +08:00
const microphoneLockEnforced = false;
2017-04-19 22:59:57 +08:00
2017-04-19 23:01:28 +08:00
const userData = {
userId,
username,
voiceBridge,
microphoneLockEnforced,
2017-04-19 23:01:28 +08:00
};
AudioManager.init(userData);
2017-04-19 23:01:28 +08:00
};
2017-04-19 22:59:57 +08:00
const exitAudio = () => AudioManager.exitAudio();
const joinListenOnly = () => AudioManager.joinAudio(true);
const joinMicrophone = () => AudioManager.joinAudio(false);
2017-03-31 01:57:05 +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
};