Skip to content

Commit

Permalink
Use microphone selected in join audio dialog during the session.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugat committed Dec 12, 2013
1 parent 6bb7f76 commit 3f0d193
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,21 @@ 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();
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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);
}
Expand All @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -237,4 +239,4 @@ package org.bigbluebutton.modules.phone.managers {
LogUtil.debug("Recieve ON METADATA from SIP");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}">
Expand Down

0 comments on commit 3f0d193

Please sign in to comment.