Search code examples
flashapache-flexstreammicrophone

Flash streaming microphone (without cam)


How I modify this code, if I want that it doesn't use the webcam, only use is microphone?

I want if it run doesn't turn on the camera.

Thanks,

private function InitCameraAndMicrophone():void {               
m_Microphone = Microphone.getEnhancedMicrophone(this.cameraSettingsDialog.dropDownListMicrophones.selectedIndex);
var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
options.autoGain = true;
options.nonLinearProcessing = true;
m_Microphone.enhancedOptions = options;
m_Microphone.codec = "Speex";
m_Microphone.encodeQuality = 10; 
m_Microphone.setUseEchoSuppression(true);

memberCamera = Camera.getCamera(this.cameraSettingsDialog.dropDownListCameras.selectedIndex.toString());    

if (memberCamera == null) 
{
    var informationTitle:String = localizatonProvider.localize('flash_information');
    var alertMessage:String = localizatonProvider.localize('flash_connect_your_camera');
    CommonHelper.javascriptFunctionCallWrap("jAlert", alertMessage + ';' + informationTitle);
    return;
}
memberCamera.setMode(this.cameraSettingsDialog.selectedResolution.x, this.cameraSettingsDialog.selectedResolution.y, 15);
memberCamera.setQuality(0, 90);
memberCamera.setKeyFrameInterval(100); */
memberVideo = new Video(405, 305);
memberVideo.attachCamera(this.memberCamera);

this.stateWhenStartedCamToCam = this.currentState;

if(userAllowedCameraAccess)
{
    ConnectCamToCam();
}
memberCamera.addEventListener(StatusEvent.STATUS, memberCameraStatusHandler);

}


Solution

  • private  function  InitCameraAndMicrophone():void  {                
        m_Microphone = Microphone.getEnhancedMicrophone(this.cameraSettingsDialog.dropDownListMicrophones.selectedIndex ); 
        var options:MicrophoneEnhancedOptions  =  new  MicrophoneEnhancedOptions(); 
        options.mode = MicrophoneEnhancedMode.FULL_DUPLEX ; 
        options.autoGain = true; 
        options.nonLinearProcessing =  true; 
        m_Microphone.enhancedOptions = options; 
        m_Microphone.codec =  "Speex";
        m_Microphone.encodeQuality =  10;
        m_Microphone.setUseEchoSuppression(true);
        selectedIndex.toString();    
        var informationTitle:String  = localizatonProvider.localize( 'flash_information' ); 
        var alertMessage:String  = localizatonProvider.localize( 'flash_connect_your_camera' ); 
        CommonHelper.javascriptFunctionCallWrap ( "jAlert" , alertMessage +  ';'  + informationTitle ); 
    }