instantiate audioManager with bridge
This commit is contained in:
parent
afcb365ac6
commit
8893b3ce19
@ -1,4 +1,4 @@
|
||||
export default class BaseAudioService {
|
||||
export default class BaseAudioBridge {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
|
@ -1,29 +1,11 @@
|
||||
import { callServer } from '/imports/ui/services/api';
|
||||
|
||||
import VertoBridge from './verto';
|
||||
import SIPBridge from './sip';
|
||||
import BaseAudioService from './base';
|
||||
import AudioManager from './manager';
|
||||
|
||||
const MEDIA_CONFIG = Meteor.settings.public.media;
|
||||
|
||||
export default class AudioAPI extends BaseAudioService {
|
||||
constructor() {
|
||||
super();
|
||||
this.audioBridge = undefined;
|
||||
this.audioBridge = MEDIA_CONFIG.useSIPAudio ? new SIPBridge() : new VertoBridge();
|
||||
}
|
||||
const audioBridge = MEDIA_CONFIG.useSIPAudio ? new SIPBridge() : new VertoBridge();
|
||||
|
||||
exitAudio (afterExitCall = () => {}) {
|
||||
this.audioBridge.exitAudio();
|
||||
}
|
||||
const audioManager = new AudioManager(audioBridge);
|
||||
|
||||
joinListenOnly() {
|
||||
callServer('listenOnlyRequestToggle', true);
|
||||
this.audioBridge.joinListenOnly();
|
||||
}
|
||||
|
||||
joinMicrophone() {
|
||||
this.audioBridge.joinMicrophone();
|
||||
}
|
||||
|
||||
};
|
||||
export default audioManager;
|
||||
|
@ -0,0 +1,26 @@
|
||||
import { callServer } from '/imports/ui/services/api';
|
||||
import BaseAudioBridge from './base';
|
||||
|
||||
export default class AudioBridge {
|
||||
constructor(audioBridge) {
|
||||
if (!(audioBridge instanceof BaseAudioBridge)) {
|
||||
throw 'Audio Bridge not compatible';
|
||||
}
|
||||
|
||||
this.bridge = audioBridge;
|
||||
}
|
||||
|
||||
exitAudio () {
|
||||
this.bridge.exitAudio();
|
||||
}
|
||||
|
||||
joinAudio(listenOnly) {
|
||||
if (listenOnly) {
|
||||
callServer('listenOnlyRequestToggle', true);
|
||||
this.bridge.joinListenOnly();
|
||||
} else {
|
||||
this.bridge.joinMicrophone();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import Users from '/imports/api/users';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import BaseAudioService from './base';
|
||||
import BaseAudioBridge from './base';
|
||||
|
||||
import {callServer} from '/imports/ui/services/api';
|
||||
import { getVoiceBridge } from '/imports/ui/components/audio/service';
|
||||
@ -11,7 +11,7 @@ const MEDIA_CONFIG = Meteor.settings.public.media;
|
||||
|
||||
let triedHangup = false;
|
||||
|
||||
export default class SIPService extends BaseAudioService {
|
||||
export default class SIPBridge extends BaseAudioBridge {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
@ -134,5 +134,4 @@ export default class SIPService extends BaseAudioService {
|
||||
}, options.isListenOnly, st);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import Users from '/imports/api/users';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import { getVoiceBridge } from '/imports/ui/components/audio/service';
|
||||
import BaseAudioService from './base';
|
||||
import BaseAudioBridge from './base';
|
||||
|
||||
export default class VertoService extends BaseAudioService {
|
||||
export default class VertoBridge extends BaseAudioBridge {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import AudioModal from './audio-modal/component';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
|
||||
import { showModal } from '/imports/ui/components/app/service';
|
||||
import AudioAPI from '/imports/api/audio/client/bridge'
|
||||
import AudioManager from '/imports/api/audio/client/bridge'
|
||||
|
||||
const handleJoinAudio = () => {
|
||||
const handleJoinListenOnly = () => joinListenOnly();
|
||||
@ -14,10 +14,9 @@ const getVoiceBridge = () => {
|
||||
return Meetings.findOne({}).voiceConf;
|
||||
} ;
|
||||
|
||||
const audioAPI = new AudioAPI();
|
||||
let exitAudio = () => audioAPI.exitAudio();
|
||||
let joinListenOnly = () => audioAPI.joinListenOnly();
|
||||
let joinMicrophone = () => audioAPI.joinMicrophone();
|
||||
let exitAudio = () => AudioManager.exitAudio();
|
||||
let joinListenOnly = () => AudioManager.joinAudio(true);
|
||||
let joinMicrophone = () => AudioManager.joinAudio(false);
|
||||
|
||||
export {
|
||||
handleJoinAudio,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import Deskshare from '/imports/api/deskshare';
|
||||
import VertoAPI from '/imports/api/audio/client/bridge/verto';
|
||||
import VertoBridge from '/imports/api/audio/client/bridge/verto';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
|
||||
const vertoAPI = new VertoAPI();
|
||||
const vertoBridge = new VertoBridge();
|
||||
|
||||
// when the meeting information has been updated check to see if it was
|
||||
// desksharing. If it has changed either trigger a call to receive video
|
||||
@ -30,12 +30,12 @@ function videoIsBroadcasting() {
|
||||
|
||||
// if remote deskshare has been ended disconnect and hide the video stream
|
||||
function presenterDeskshareHasEnded() {
|
||||
// vertoAPI.exitVoiceCall();
|
||||
// vertoBridge.exitVoiceCall();
|
||||
};
|
||||
|
||||
// if remote deskshare has been started connect and display the video stream
|
||||
function presenterDeskshareHasStarted() {
|
||||
vertoAPI.vertoWatchVideo();
|
||||
vertoBridge.vertoWatchVideo();
|
||||
};
|
||||
|
||||
export {
|
||||
|
Loading…
Reference in New Issue
Block a user