set state for AudioManager when joining or leaving audio
This commit is contained in:
parent
6dd71a3ee0
commit
12d42aaecb
@ -1,7 +1,49 @@
|
||||
import BaseAudioBridge from '../bridge/base';
|
||||
import VertoBridge from '../bridge/verto';
|
||||
import SIPBridge from '../bridge/sip';
|
||||
|
||||
|
||||
CallStates = class {
|
||||
static get init() {
|
||||
return "initialized state";
|
||||
}
|
||||
static get echo() {
|
||||
return "do echo test state";
|
||||
}
|
||||
static get callIntoEcho() {
|
||||
return "calling into echo test state";
|
||||
}
|
||||
static get inEchoTest() {
|
||||
return "in echo test state";
|
||||
}
|
||||
static get joinVoiceConference() {
|
||||
return "join voice conference state";
|
||||
}
|
||||
static get callIntoConference() {
|
||||
return "calling into conference state";
|
||||
}
|
||||
static get inConference() {
|
||||
return "in conference state";
|
||||
}
|
||||
static get transferToConference() {
|
||||
return "joining from echo into conference state";
|
||||
}
|
||||
static get echoTestFailed() {
|
||||
return "echo test failed state";
|
||||
}
|
||||
static get callToListenOnly() {
|
||||
return "call to listen only state";
|
||||
}
|
||||
static get connectToListenOnly() {
|
||||
return "connecting to listen only state";
|
||||
}
|
||||
static get inListenOnly() {
|
||||
return "in listen only state";
|
||||
}
|
||||
static get reconnecting() {
|
||||
return "reconecting";
|
||||
}
|
||||
};
|
||||
|
||||
// manages audio calls and audio bridges
|
||||
export default class AudioManager {
|
||||
constructor(userData) {
|
||||
@ -17,7 +59,9 @@ export default class AudioManager {
|
||||
this.bridge = audioBridge;
|
||||
this.isListenOnly = false;
|
||||
this.microphoneLockEnforced = userData.microphoneLockEnforced;
|
||||
this.currentState = this.CallStates.init;
|
||||
this.callStates = new CallStates();
|
||||
console.log(this.callStates);
|
||||
this.currentState = this.callStates.init;
|
||||
|
||||
callbackToAudioBridge = function (audio) {
|
||||
switch (audio.status) {
|
||||
@ -42,16 +86,20 @@ export default class AudioManager {
|
||||
}
|
||||
|
||||
exitAudio() {
|
||||
this.bridge.exitAudio(this.isListenOnly);
|
||||
this.bridge.exitAudio(this.isListenOnly);
|
||||
this.currentState = this.callStates.init;
|
||||
}
|
||||
|
||||
joinAudio(listenOnly) {
|
||||
if (listenOnly || this.microphoneLockEnforced) {
|
||||
this.isListenOnly = true;
|
||||
this.bridge.joinListenOnly(callbackToAudioBridge);
|
||||
this.currentState = this.callStates.inListenOnly;
|
||||
} else {
|
||||
this.bridge.joinMicrophone(callbackToAudioBridge);
|
||||
}
|
||||
this.currentState = this.callStates.inConference;
|
||||
}
|
||||
console.log("CURRENT STATE: " + this.currentState);
|
||||
}
|
||||
|
||||
transferToConference() {
|
||||
@ -92,45 +140,3 @@ export default class AudioManager {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AudioManager.CallStates = class {
|
||||
static get init() {
|
||||
return "initialized state";
|
||||
}
|
||||
static get echo() {
|
||||
return "do echo test state";
|
||||
}
|
||||
static get callIntoEcho() {
|
||||
return "calling into echo test state";
|
||||
}
|
||||
static get inEchoTest() {
|
||||
return "in echo test state";
|
||||
}
|
||||
static get joinVoiceConference() {
|
||||
return "join voice conference state";
|
||||
}
|
||||
static get callIntoConference() {
|
||||
return "calling into conference state";
|
||||
}
|
||||
static get inConference() {
|
||||
return "in conference state";
|
||||
}
|
||||
static get transferToConference() {
|
||||
return "joining from echo into conference state";
|
||||
}
|
||||
static get echoTestFailed() {
|
||||
return "echo test failed state";
|
||||
}
|
||||
static get callToListenOnly() {
|
||||
return "call to listen only state";
|
||||
}
|
||||
static get connectToListenOnly() {
|
||||
return "connecting to listen only state";
|
||||
}
|
||||
static get inListenOnly() {
|
||||
return "in listen only state";
|
||||
}
|
||||
static get reconnecting() {
|
||||
return "reconecting";
|
||||
}
|
||||
};
|
||||
|
@ -3,6 +3,7 @@ import { createContainer } from 'meteor/react-meteor-data';
|
||||
import Button from '/imports/ui/components/button/component';
|
||||
import { withRouter } from 'react-router';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import AudioManager from '/imports/api/audio/client/manager';
|
||||
|
||||
const intlMessages = defineMessages({
|
||||
joinAudio: {
|
||||
@ -26,6 +27,8 @@ class JoinAudioOptions extends React.Component {
|
||||
} = this.props;
|
||||
|
||||
if (isInAudio || isInListenOnly) {
|
||||
// if (AudioManager.currentState == AudioManager.callStates.inConference ||
|
||||
// AudioManager.currentState == AudioManager.callStates.inListenOnly) {
|
||||
return (
|
||||
<Button
|
||||
onClick={handleCloseAudio}
|
||||
|
Loading…
Reference in New Issue
Block a user