Loading ...
Sorry, an error occurred while loading the content.
 

Re: [flexcoders] check if the user has "block all sites from using the camera and microphone"

Expand Messages
  • dorkie dork from dorktown
    I don t know of a property that tells you this. But there may be a way to find out with the users help. If the mic is muted I open an alert window and tell the
    Message 1 of 3 , Aug 2, 2012
      I don't know of a property that tells you this. But there may be a way to find out with the users help.

      If the mic is muted I open an alert window and tell the user that they'll need to enable it in the settings dialog. If they click OK to the alert window then I open the Flash microphone settings window and listen for the mic status change event to know when they've made a choice.

      When you hear back from that event (in onMicAccessChange) you can check if the muted property is still true. If they say yes then the user may have the global settings selected. You can then inform them that the global settings might be preventing your app from accessing the mic and then ask them to check the global settings themselves or open the global settings page for them. You may want to show another alert asking if the global mute was enabled and if they click Yes then reload the app).


              /**
               * Shows dialog if microphone is not enabled or available.
               */
              public function enableMicrophone():void {
                  microphone = Microphone.getMicrophone();

                  // If Microphone.getMicrophone() returns null, either the microphone is in use by
                  // another application, or there are no microphones installed on the system.
                  // To determine whether any microphones are installed, use Microphones.names.length.
                  if (microphone == null) {
                      Alert.show("You will need to select a microphone and allow this application to access it.", "Microphone Required", 4, FlexGlobals.topLevelApplication as Sprite, selectMicrophoneHandler);
                  }

                  if (microphone.muted) {
                      Alert.show("You will need to allow access to you microphone to continue. Select Allow.", "Microphone Required", 4, FlexGlobals.topLevelApplication as Sprite, allowAccessToMicrophoneHandler);
                  }

              }


              /**
               *
               * @param event
               */
              public function selectMicrophoneHandler(event:CloseEvent):void {

                  // show settings if mic is muted
                  if (event.detail == Alert.OK) {
                      Security.showSettings(SecurityPanel.MICROPHONE);
                      displayedMicrophoneSettings = true;
                  }
                  else if (event.detail == Alert.CANCEL) {

                      if (microphone == null) {
                          Alert.show("If you don't have a microphone or have selected one from the menu you won't be able to record audio...");
                      }
                  }

              }


              /**
               *
               * @param event
               */
              public function allowAccessToMicrophoneHandler(event:CloseEvent):void {

                  // show settings if mic is muted
                  if (event.detail == Alert.OK) {
                      Security.showSettings(SecurityPanel.PRIVACY);
                      displayedPrivacySettings = true;
                  }

                  // user canceled selection
                  else if (event.detail == Alert.CANCEL) {

                      // user chose to not allow microphone access
                      // may need to reload the app to pop up the security dialog again
                      if (microphone.muted) {
                          Alert.show("If you don't enable your microphone you won't be able to record anything...");
                      }
                  }


                  // set mic name and mute status
                  if (microphone && !microphone.hasEventListener(StatusEvent.STATUS)) {
                      microphone.addEventListener(StatusEvent.STATUS, onMicAccessChange);
                  }

              }


              /**
               *
               * @param event
               */
              public function onMicAccessChange(event:StatusEvent):void {
                  statusCode = event.code;
                  statusMessageLevel = event.level;
                  // check for microphone is still muted here
              }


      On Tue, Jun 19, 2012 at 12:23 PM, Chuck Preston <itsmechuckjr@...> wrote:
       

      Is there a way to check if the user has selected "block all sites from using the camera and microphone" in the global Flash settings with AS3?

      I'm trying to access the microphone and if the user has "block all sites..." selected, I need to put up a dialog box. Microphone.muted is true if the user has "block all sites..." selected or not.


    • Chuck Preston
      Hi Judah, That s a cool way to do it. We were going to do a technique like skype uses where you put up a screen with a VU type meter that shows the volume
      Message 2 of 3 , Aug 2, 2012
        Hi Judah,

        That's a cool way to do it. We were going to do a technique like "skype" uses where you put up a screen with a VU type meter that shows the volume level from the microphone, and then tell the user to talk into the mic and ask them if they see the meter moving. If they click the "Yes" button, we start the app. If they click the "No" button, we put up the "you must have a microphone plugged in...." screen. But, the client decided that the checking we were already doing covered enough of the use cases, even if it didn't catch the "block all sites..." setting use case.

        --- In flexcoders@yahoogroups.com, dorkie dork from dorktown <dorkiedorkfromdorktown@...> wrote:
        >
        > I don't know of a property that tells you this. But there may be a way to
        > find out with the users help.
        >
        > If the mic is muted I open an alert window and tell the user that they'll
        > need to enable it in the settings dialog. If they click OK to the alert
        > window then I open the Flash microphone settings window and listen for the
        > mic status change event to know when they've made a choice.
        >
        > When you hear back from that event (in onMicAccessChange) you can check if
        > the muted property is still true. If they say yes then the user may have
        > the global settings selected. You can then inform them that the global
        > settings might be preventing your app from accessing the mic and then ask
        > them to check the global settings themselves or open the global settings
        > page for them. You may want to show another alert asking if the global mute
        > was enabled and if they click Yes then reload the app).
        >
        >
        > /**
        > * Shows dialog if microphone is not enabled or available.
        > */
        > public function enableMicrophone():void {
        > microphone = Microphone.getMicrophone();
        >
        > // If Microphone.getMicrophone() returns null, either the
        > microphone is in use by
        > // another application, or there are no microphones installed
        > on the system.
        > // To determine whether any microphones are installed, use
        > Microphones.names.length.
        > if (microphone == null) {
        > Alert.show("You will need to select a microphone and allow
        > this application to access it.", "Microphone Required", 4,
        > FlexGlobals.topLevelApplication as Sprite, selectMicrophoneHandler);
        > }
        >
        > if (microphone.muted) {
        > Alert.show("You will need to allow access to you microphone
        > to continue. Select Allow.", "Microphone Required", 4,
        > FlexGlobals.topLevelApplication as Sprite, allowAccessToMicrophoneHandler);
        > }
        >
        > }
        >
        >
        > /**
        > *
        > * @param event
        > */
        > public function selectMicrophoneHandler(event:CloseEvent):void {
        >
        > // show settings if mic is muted
        > if (event.detail == Alert.OK) {
        > Security.showSettings(SecurityPanel.MICROPHONE);
        > displayedMicrophoneSettings = true;
        > }
        > else if (event.detail == Alert.CANCEL) {
        >
        > if (microphone == null) {
        > Alert.show("If you don't have a microphone or have
        > selected one from the menu you won't be able to record audio...");
        > }
        > }
        >
        > }
        >
        >
        > /**
        > *
        > * @param event
        > */
        > public function
        > allowAccessToMicrophoneHandler(event:CloseEvent):void {
        >
        > // show settings if mic is muted
        > if (event.detail == Alert.OK) {
        > Security.showSettings(SecurityPanel.PRIVACY);
        > displayedPrivacySettings = true;
        > }
        >
        > // user canceled selection
        > else if (event.detail == Alert.CANCEL) {
        >
        > // user chose to not allow microphone access
        > // may need to reload the app to pop up the security dialog
        > again
        > if (microphone.muted) {
        > Alert.show("If you don't enable your microphone you
        > won't be able to record anything...");
        > }
        > }
        >
        >
        > // set mic name and mute status
        > if (microphone &&
        > !microphone.hasEventListener(StatusEvent.STATUS)) {
        > microphone.addEventListener(StatusEvent.STATUS,
        > onMicAccessChange);
        > }
        >
        > }
        >
        >
        > /**
        > *
        > * @param event
        > */
        > public function onMicAccessChange(event:StatusEvent):void {
        > statusCode = event.code;
        > statusMessageLevel = event.level;
        > // check for microphone is still muted here
        > }
        >
        >
        > On Tue, Jun 19, 2012 at 12:23 PM, Chuck Preston <itsmechuckjr@...>wrote:
        >
        > > **
        > >
        > >
        > > Is there a way to check if the user has selected "block all sites from
        > > using the camera and microphone" in the global Flash settings with AS3?
        > >
        > > I'm trying to access the microphone and if the user has "block all
        > > sites..." selected, I need to put up a dialog box. Microphone.muted is true
        > > if the user has "block all sites..." selected or not.
        > >
        > >
        > >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.