From 12d42aaecb857afa1f10d44d08c3a496705a9bf0 Mon Sep 17 00:00:00 2001 From: Matthew Marangoni Date: Fri, 16 Jun 2017 13:22:17 -0700 Subject: [PATCH] set state for AudioManager when joining or leaving audio --- .../imports/api/audio/client/manager/index.js | 98 ++++++++++--------- .../components/audio/audio-menu/component.jsx | 3 + 2 files changed, 55 insertions(+), 46 deletions(-) diff --git a/bigbluebutton-html5/imports/api/audio/client/manager/index.js b/bigbluebutton-html5/imports/api/audio/client/manager/index.js index f62c9421b2..33f97dd294 100755 --- a/bigbluebutton-html5/imports/api/audio/client/manager/index.js +++ b/bigbluebutton-html5/imports/api/audio/client/manager/index.js @@ -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"; - } -}; diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-menu/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-menu/component.jsx index 2d6b33775e..838f4b6032 100755 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-menu/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-menu/component.jsx @@ -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 (