AEC in Flash, getEnhancedMicrophone

旧城冷巷雨未停 提交于 2019-12-19 04:58:14

问题


Have next problem:

var mic:Microphone = Microphone.getEnhancedMicrophone();
mic.setLoopBack(true);

And I don`t hear any sound... What is it? When I write Microphone.getMicrophone() all work right and I hear sounds.


回答1:


To work around it, try the following steps:

1) install debug player 10.3 or higher

It's very likely that you run it with NOT debug version of flash player, that is why you miss important warnings and exceptions.

2) allow users to accept access to the microphone:

Security.showSettings("2");

3) compile a SWF with following option:

-swf-version=12

To use new features in 10.3, you have to publish the SWF to target "Flash Player 11". Otherwise getEnhancedMicrophone() function won't be visible.


[EDIT]

To make it work in Adobe Flash CS5 you need to:

3.1) go to

${FLASH_CS5_HOME}\Common\Configuration\ActionScript 3.0

3.2) create a new folder with the name FP10.3

3.3) copy the file and paste it in the following location:

${FLASH_CS5_HOME}\Common\Configuration\ActionScript 3.0\FP10.3

3.4) rename the swc name to playerglobal.swc

3.5) go to

${FLASH_CS5_HOME}\Common\Configuration\Players

3.6) create a copy of FlashPlayer10_1.xml and rename as FlashPlayer10_3.xml

3.7) open it in an editor and change according to below:

<player id="FlashPlayer10.3" version="12" asversion="3">
   <name>Flash Player 10.3</name>
   <path builtin="true"/>
   <path platform="WIN">Device Central/adcdl.exe</path>
   <path platform="MAC">Device Central/adcdl</path>
   <playerDefinitionPath as2="$(UserConfig)/Classes/FP10;$(UserConfig)/Classes/FP9;$(UserConfi g)/Classes/FP8;$(UserConfig)/Classes/FP7" as3="$(AppConfig)/ActionScript 3.0/FP10.3/playerglobal.swc" />

3.8) close the flash application if launched and restart the flash application

3.9) if you promptly followed everything you will Flash player 10.3 in the target players from the publish settings and change your target to Flash Player 10.3

3.10) now import two statements:

      import flash.media.Microphone;
      import flash.media.MicrophoneEnhancedMode;

[/EDIT]


Example:

public function init():void {
    var mic:Microphone = Microphone.getEnhancedMicrophone();
    Security.showSettings("2");
    mic.setLoopBack(true);
    if (mic != null) {
        mic.setSilenceLevel(0);
        mic.rate = 16;
        mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
        mic.addEventListener(StatusEvent.STATUS, statusHandler);
    }
}

private function activityHandler(event:ActivityEvent):void {
    trace("activityHandler: " + event);
}

private function statusHandler(event:StatusEvent):void {
    trace("statusHandler: " + event);
}

Hope this helps.



来源:https://stackoverflow.com/questions/6581453/aec-in-flash-getenhancedmicrophone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!