bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/service.js
2017-06-02 19:25:02 +00:00

43 lines
1.1 KiB
JavaScript
Executable File

import React from 'react';
import AudioModal from './audio-modal/component';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import AudioManager from '/imports/api/audio/client/manager';
let audioManager;
const init = () => {
const userId = Auth.userID;
const User = Users.findOne({ userId });
const username = User.user.name;
const Meeting = Meetings.findOne(); // TODO test this with Breakouts
const turns = Meeting.turns;
const stuns = Meeting.stuns;
const voiceBridge = Meeting.voiceConf;
const microphoneLockEnforced = Meeting.roomLockSettings.disableMic;
const userData = {
userId,
username,
turns,
stuns,
voiceBridge,
microphoneLockEnforced,
};
audioManager = new AudioManager(userData);
};
const exitAudio = () => audioManager.exitAudio();
const joinListenOnly = () => audioManager.joinAudio(true);
const joinMicrophone = () => audioManager.joinAudio(false);
export default {
init,
exitAudio,
joinListenOnly,
joinMicrophone,
};