I am currently creating a website that requires interaction with a microphone. I have already created a Flash component that processes sound and its external interfaces.
The goal of external interfaces, as you might guess, is to allow full processing of the HTML / CSS / Javascript interface. It works great, except for a few things. First, a Flash movie is no longer responsive if it is not displayed. I put together a solution for this, just having it 1 pixel by 1 pixel in another unused part of the viewport.
Another problem is that Flash sometimes presents a security dialog that asks the user for access. Now I have figured out how to force a dialog :
Security.showSettings(SecurityPanel.PRIVACY);
Fine (question: how can I fire this fire on a callback when the setting is turned off?).
But this has two drawbacks:
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 think that getting around both of them is to have one global flag (or more useful, a binding attribute or event) to get the security status at the moment and when it was changed.
Any ideas would be appreciated.
Update
I joked a bit and wrote 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 problem is that since there seems to be no way to find out if the user is asking for a choice to be remembered in the security domain, I cannot imagine a standalone lightweight SWF designed to ask for permission.