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

54 lines
1.2 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() }).name;
2017-07-24 22:15:46 +08:00
}
getExtension() {
2017-07-27 01:58:39 +08:00
const extension = Meetings.findOne().voiceProp.voiceConf;
2017-07-24 22:15:46 +08:00
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);
}
2017-08-01 04:54:18 +08:00
getSessionToken(callback) {
callback(Auth.sessionToken);
}
2017-07-24 22:15:46 +08:00
}
export const initBBB = () => {
if (window.BBB == undefined) {
window.BBB = new BBB();
}
};