如何在ActionAcript3中关闭麦克风

时间:2014-01-08 23:47:25

标签: actionscript-3 microphone

如何在AS3中关闭麦克风?示例代码如下。我想通过调用closeMicrophone()函数来关闭(关闭)麦克风。

var microphone:Microphone = null;
function openMicrophone():void{
    if(Microphone.isSupported){
        Security.showSettings(SecurityPanel.PRIVACY);
        microphone = Microphone.getMicrophone();
        if(microphone != null){
            microphone.setLoopBack();
            microphone.setSilenceLevel(5, 2000);
            }else{
            trace('No microphone found!');
            }
        }else{
        trace('The Microphone class is not supported on this system!');
        }
    }
function closeMicrophone():void{
    // Here, I want to turn off microphone.
    }

1 个答案:

答案 0 :(得分:0)

您想要禁用麦克风环回,对吗?然后,再次调用setLoopBack方法,并将false作为参数。

function closeMicrophone():void{
    microphone.setLoopBack(false);
    microphone = null;
}