2018-04-28 05:37:41 +08:00
|
|
|
import BaseAudioBridge from './base';
|
|
|
|
|
2018-04-29 08:18:54 +08:00
|
|
|
const MEDIA = Meteor.settings.public.media;
|
|
|
|
const MEDIA_TAG = MEDIA.mediaTag;
|
|
|
|
|
2018-04-28 05:37:41 +08:00
|
|
|
export default class KurentoAudioBridge extends BaseAudioBridge {
|
|
|
|
constructor(userData) {
|
|
|
|
super();
|
|
|
|
const {
|
|
|
|
userId,
|
|
|
|
username,
|
|
|
|
voiceBridge,
|
|
|
|
internalMeetingID,
|
|
|
|
} = userData;
|
|
|
|
|
|
|
|
this.userId = userId;
|
|
|
|
this.userName = username;
|
|
|
|
this.internalMeetingID = voiceBridge;
|
|
|
|
this.voiceBridge = voiceBridge;
|
|
|
|
}
|
|
|
|
|
|
|
|
exitAudio(listenOnly) {
|
|
|
|
window.kurentoExitAudio();
|
|
|
|
}
|
|
|
|
|
2018-04-29 08:18:54 +08:00
|
|
|
joinAudio({ isListenOnly }, callback) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this.callback = callback;
|
|
|
|
if (!isListenOnly) {
|
|
|
|
return resolve();
|
|
|
|
}
|
|
|
|
|
|
|
|
window.kurentoJoinAudio(
|
|
|
|
"remote-media",
|
|
|
|
this.voiceBridge,
|
|
|
|
"GLOBAL_AUDIO_" + this.voiceBridge,
|
|
|
|
this.internalMeetingID,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
this.userId,
|
|
|
|
this.userName,
|
|
|
|
null,
|
|
|
|
);
|
|
|
|
|
|
|
|
resolve (this.callback({ status: this.baseCallStates.started }));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
exitAudio() {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
window.kurentoExitAudio();
|
|
|
|
return resolve (this.callback({status: this.baseCallStates.ended}));
|
|
|
|
});
|
2018-04-28 05:37:41 +08:00
|
|
|
}
|
|
|
|
}
|