bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/bbb/index.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-07-24 22:15:46 +08:00
import AudioManager from '/imports/api/2.0/audio/client/manager';
import Auth from '/imports/ui/services/auth';
import Users from '/imports/api/2.0/users';
import Meetings from '/imports/api/2.0/meetings';
class BBB {
getUserId() {
const userID = Auth.userID;
return userID;
}
getUsername() {
return Users.findOne({ userId: this.getUserId() }).user.name;
}
getExtension() {
const extension = Meetings.findOne().voiceConf;
return extension;
}
getMyUserInfo(callback) {
const result = {
myUserID: this.getUserId(),
myUsername: this.getUsername(),
myInternalUserID: this.getUserId(),
myAvatarURL: null,
myRole: 'getMyRole',
amIPresenter: 'false',
voiceBridge: this.getExtension(),
dialNumber: null,
};
return callback(result);
}
webRTCCallFailed(inEchoTest, errorcode, cause) {
AudioManager.webRTCCallFailed(inEchoTest, errorcode, cause);
}
webRTCCallStarted(inEchoTest) {
AudioManager.webRTCCallStarted(inEchoTest);
}
}
export const initBBB = () => {
if (window.BBB == undefined) {
window.BBB = new BBB();
}
};