Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a global way to check whether microphone access has been granted in Flash?

I'm currently building an website that requires microphone interaction. I have already built the Flash component that handles the sound and its external interfaces.

The purpose of the external interfaces, as you might guess, is to allow for the UI to be entirely handled by HTML/CSS/Javascript. It works great, except for a couple of things. The first is that the Flash movie stops being responsive if it's not visible. I have kludged together a solution to this by just having it be 1 pixel by 1 pixel in an otherwise unused part of the viewport.

The other issue is that Flash sometimes presents a security dialog asking the user for access. Now, I've figured out how to forcefully cause the security dialog to appear:

Security.showSettings(SecurityPanel.PRIVACY);

Fine (side question: how can I have this fire a callback when the setting is tripped?).

But this has two downsides:

1. It doesn't theoretically catch the case where the user revokes privileges during the running of the application.
2. It doesn't detect if the user has already granted permission.

I figure a way around both of these is to have a single global flag (or more helpfully, a bindable attribute or event) to get what the security status currently is and when it's been changed.

Any insights would be greatly appreciated.

Update

I've poked around a bit more and wrote up this:

import flash.system.Security;
import flash.system.SecurityPanel;
import flash.external.ExternalInterface;
import flash.media.Microphone;
import flash.events.StatusEvent;

var m:Microphone = Microphone.getMicrophone();

m.addEventListener(StatusEvent.STATUS, function(e:StatusEvent){
    if(e.code == "Microphone.Unmuted") {
        ExternalInterface.call('window.SpeechWrapper.messenger.microphonePermissionGranted');
    } else {
        ExternalInterface.call('window.SpeechWrapper.messenger.microphonePermissionDenied');
    }
});

if(m.muted) {
    Security.showSettings(SecurityPanel.PRIVACY);
} else {
    ExternalInterface.call('window.SpeechWrapper.messenger.microphonePermissionGranted');
}

However, the trouble is that since there doesn't appear to be a way to figure out whether the user has asked for the choice to be remembered across the security domain, I am not able to present a standalone lightweight swf designed to ask for permission.

like image 926
Steven Avatar asked Aug 29 '11 20:08

Steven


People also ask

How do I allow Adobe Flash Player to access my microphone?

Microphone SettingsRight-click (Windows) or Control-click (Mac) and select Settings. In the Adobe Flash Player Settings window, click the tab with the microphone icon, and make sure your headset is selected.

How do I unblock my microphone?

Tap Site Settings. Tap Microphone or Camera. Tap to turn the microphone or camera on or off. Allow.

How do I authorize my microphone?

Select Start > Settings > Privacy > Microphone . In Allow access to the microphone on this device, select Change and make sure Microphone access for this device is turned on.


1 Answers

the property is called muted. answered by Steven Xu in comments.

like image 171
csomakk Avatar answered Sep 21 '22 16:09

csomakk