66 lines
2.2 KiB
Plaintext
66 lines
2.2 KiB
Plaintext
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
|
||
|
layout="absolute" width="215" height="138"
|
||
|
applicationComplete="appInit()">
|
||
|
<mx:Script>
|
||
|
<![CDATA[
|
||
|
private function appInit():void {
|
||
|
if (ExternalInterface.available) {
|
||
|
ExternalInterface.addCallback("showMicSettings", handleShowMicSettingsRequest);
|
||
|
ExternalInterface.addCallback("testMicrophone", handleShowMicSettingsRequest);
|
||
|
}
|
||
|
|
||
|
// Tell out JS counterpart that we are ready.
|
||
|
if (ExternalInterface.available) {
|
||
|
ExternalInterface.call("BBBCheck.microphoneCheckAppReady");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private var mic:Microphone;
|
||
|
|
||
|
private function handleShowMicSettingsRequest():void {
|
||
|
mic = Microphone.getMicrophone();
|
||
|
|
||
|
if (mic != null) {
|
||
|
if (mic.muted) {
|
||
|
// user has disallowed access to the mic
|
||
|
mic.addEventListener(StatusEvent.STATUS, micStatusEventHandler);
|
||
|
Security.showSettings(SecurityPanel.PRIVACY);
|
||
|
} else {
|
||
|
// user has allowed access to the mic
|
||
|
mic.setLoopBack(false);
|
||
|
mic.setUseEchoSuppression(true);
|
||
|
}
|
||
|
} else {
|
||
|
ExternalInterface.call("BBBCheck.noAvailableMicrophoneError");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private function micStatusEventHandler(event:StatusEvent):void {
|
||
|
switch(event.code) {
|
||
|
case "Microphone.Muted":
|
||
|
ExternalInterface.call("BBBCheck.microphoneAccessDenied");
|
||
|
break;
|
||
|
case "Microphone.Unmuted":
|
||
|
ExternalInterface.call("BBBCheck.microphoneAccessAllowed");
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private function handleTestMicrophoneRequest(loopback:Boolean=false):void {
|
||
|
if (loopback) {
|
||
|
if (mic != null) {
|
||
|
mic.setLoopBack(true);
|
||
|
mic.setUseEchoSuppression(true);
|
||
|
}
|
||
|
|
||
|
Security.showSettings(SecurityPanel.MICROPHONE);
|
||
|
} else {
|
||
|
mic.setLoopBack(false);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
]]>
|
||
|
</mx:Script>
|
||
|
</mx:Application>
|