如何在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.
}
答案 0 :(得分:0)
您想要禁用麦克风环回,对吗?然后,再次调用setLoopBack
方法,并将false
作为参数。
function closeMicrophone():void{
microphone.setLoopBack(false);
microphone = null;
}