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

@ -231,11 +231,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
}
public function joinConference():void{
cleanUp();
public function joinConference():void{
var joinEvent:BBBEvent = new BBBEvent("JOIN_VOICE_CONFERENCE_EVENT");
joinEvent.payload['useMicrophone'] = true;
dispatchEvent(joinEvent);
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();
}
@ -112,10 +112,10 @@ package org.bigbluebutton.modules.phone.managers {
private function setupConnection():void {
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

@ -18,18 +18,18 @@
*/
package org.bigbluebutton.modules.phone.managers {
import com.asfusion.mate.events.Dispatcher;
import flash.events.ActivityEvent;
import flash.events.AsyncErrorEvent;
import flash.events.IEventDispatcher;
import flash.events.NetStatusEvent;
import flash.events.StatusEvent;
import flash.media.Microphone;
import flash.media.MicrophoneEnhancedMode;
import flash.media.MicrophoneEnhancedOptions;
import flash.media.SoundCodec;
import flash.net.NetConnection;
import flash.net.NetStream;
import com.asfusion.mate.events.Dispatcher;
import flash.events.ActivityEvent;
import flash.events.AsyncErrorEvent;
import flash.events.IEventDispatcher;
import flash.events.NetStatusEvent;
import flash.events.StatusEvent;
import flash.media.Microphone;
import flash.media.MicrophoneEnhancedMode;
import flash.media.MicrophoneEnhancedOptions;
import flash.media.SoundCodec;
import flash.net.NetConnection;
import flash.net.NetStream;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.main.events.BBBEvent;
@ -42,11 +42,12 @@ package org.bigbluebutton.modules.phone.managers {
private var incomingStream:NetStream = null
private var outgoingStream:NetStream = null;
private var publishName:String = null;
private var mic:Microphone = 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";
private var dispatcher:Dispatcher;
private var audioCodec:String = "SPEEX";
private var dispatcher:Dispatcher;
public function StreamManager() {
dispatcher = new Dispatcher();
@ -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);
}
@ -74,8 +77,8 @@ package org.bigbluebutton.modules.phone.managers {
}
if ((BBB.getFlashPlayerVersion() >= 10.3) && (phoneOptions.enabledEchoCancel)) {
LogUtil.debug("Using acoustic echo cancellation.");
mic = Microphone(Microphone["getEnhancedMicrophone"]());
LogUtil.debug("Using acoustic echo cancellation.");
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 {
@ -237,4 +239,4 @@ package org.bigbluebutton.modules.phone.managers {
LogUtil.debug("Recieve ON METADATA from SIP");
}
}
}
}

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}">