Use microphone selected in join audio dialog during the session.

This commit is contained in:
Gustavo Salazar 2013-12-12 09:29:27 -08:00
parent 6bb7f7690d
commit 3f0d193644
4 changed files with 33 additions and 30 deletions

View File

@ -232,10 +232,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
public function joinConference():void{
cleanUp();
var joinEvent:BBBEvent = new BBBEvent("JOIN_VOICE_CONFERENCE_EVENT");
joinEvent.payload['useMicrophone'] = true;
joinEvent.payload['microphoneIndex'] = mic.index;
dispatchEvent(joinEvent);
cleanUp();
PopUpManager.removePopUp(this);
}

View File

@ -101,10 +101,10 @@ package org.bigbluebutton.modules.phone.managers {
|| ((Microphone.names.length == 1) && (Microphone.names[0] == "Unknown Microphone")));
}
private function setupMic(useMic:Boolean):void {
private function setupMic(useMic:Boolean, microphoneIndex:int):void {
withMic = useMic;
if (withMic)
streamManager.initMicrophone();
streamManager.initMicrophone(microphoneIndex);
else
streamManager.initWithNoMicrophone();
}
@ -113,9 +113,9 @@ package org.bigbluebutton.modules.phone.managers {
streamManager.setConnection(connectionManager.getConnection());
}
public function joinVoice(autoJoin:Boolean):void {
public function joinVoice(autoJoin:Boolean, microphoneIndex:int = 0):void {
userHangup = false;
setupMic(autoJoin);
setupMic(autoJoin, microphoneIndex);
var uid:String = String(Math.floor(new Date().getTime()));
var uname:String = encodeURIComponent(UsersUtil.getMyExternalUserID() + "-bbbID-" + attributes.username);
connectionManager.connect(uid, attributes.internalUserID, uname , attributes.room, attributes.uri);

View File

@ -43,6 +43,7 @@ package org.bigbluebutton.modules.phone.managers {
private var outgoingStream:NetStream = null;
private var publishName:String = null;
private var mic:Microphone = null;
private var micIndex:int = 0;
private var isCallConnected:Boolean = false;
private var muted:Boolean = false;
private var audioCodec:String = "SPEEX";
@ -56,11 +57,13 @@ package org.bigbluebutton.modules.phone.managers {
this.connection = connection;
}
public function initMicrophone():void {
mic = Microphone.getMicrophone(-1);
public function initMicrophone(microphoneIndex:int):void {
mic = Microphone.getMicrophone(-1);
this.micIndex = microphoneIndex;
if(mic == null){
initWithNoMicrophone();
} else {
LogUtil.debug("Setting up microphone");
setupMicrophone();
mic.addEventListener(StatusEvent.STATUS, micStatusHandler);
}
@ -75,7 +78,7 @@ package org.bigbluebutton.modules.phone.managers {
if ((BBB.getFlashPlayerVersion() >= 10.3) && (phoneOptions.enabledEchoCancel)) {
LogUtil.debug("Using acoustic echo cancellation.");
mic = Microphone(Microphone["getEnhancedMicrophone"]());
mic = Microphone.getEnhancedMicrophone(micIndex);
var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
options.autoGain = false;
@ -100,7 +103,6 @@ package org.bigbluebutton.modules.phone.managers {
mic.rate = 8;
LogUtil.debug("Using Nellymoser codec.");
}
mic.gain = 60;
}
public function initWithNoMicrophone(): void {

View File

@ -65,7 +65,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</EventHandlers>
<EventHandlers type="JOIN_VOICE_CONFERENCE_EVENT">
<MethodInvoker generator="{PhoneManager}" method="joinVoice" arguments="{event.payload.useMicrophone}"/>
<MethodInvoker generator="{PhoneManager}" method="joinVoice" arguments="{[event.payload.useMicrophone, event.payload.microphoneIndex]}"/>
</EventHandlers>
<EventHandlers type="{CallConnectedEvent.CALL_CONNECTED_EVENT}">