locked
Detect that the Microphone is disabled RRS feed

  • Question

  • I want to detect if the user turned off the Microphone on a Windows Store app on the fly. I know that it is possible because Audio Recorder uses it. But how?

    Is there anything to do with this? http://msdn.microsoft.com/en-us/library/windows/desktop/dd370810(v=vs.85).aspx

    Saturday, April 6, 2013 9:29 PM

Answers

  • There is no notification when the user denies permission to the Microphone. The highlighted toggle control in the Permissions pane is provided by the system, not by the app. The Audio Recorder app does not have any control over that pane.

    The app should just try to use the media API it needs and handle the access denied exceptions if the user has denied access.

    --Rob

    Saturday, April 13, 2013 3:03 AM
    Moderator

All replies

  • Saturday, April 6, 2013 9:31 PM
  • Hi,

    I'll try to involve more experts in this case.


    Aaron
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 10, 2013 9:59 AM
  • Thank you!
    Wednesday, April 10, 2013 12:48 PM
  • There is no notification when the user denies permission to the Microphone. The highlighted toggle control in the Permissions pane is provided by the system, not by the app. The Audio Recorder app does not have any control over that pane.

    The app should just try to use the media API it needs and handle the access denied exceptions if the user has denied access.

    --Rob

    Saturday, April 13, 2013 3:03 AM
    Moderator
  • Hi Rob, 

    I do understand why is not possible to be notified when the user turns off the microphone permission. However, I believe the Microsoft should provides a way to the application being notified easily. I think you are suggesting that the application should polling the media API in certain amount of times in order to be notified of this change. Am I correct?


    Saturday, April 13, 2013 5:52 PM
  • No, you shouldn't poll. Polling should be avoided whenever possible.

    Why does your app need to know if the microphone is available? What is the scenario that requires this?

    Normally the app should assume that the microphone is available and call the audio capture API when the app needs to capture audio. If the user denied microphone access then the app will receive an Access Denied exception and can deal with it appropriately.

    Trying to figure out ahead of time if the microphone is available is not generally useful. Even if the app could check for it, the data may be out of date by the time the app tried to use it.

    --Rob

    Tuesday, April 16, 2013 2:13 AM
    Moderator
  • If the recording has started the audio capture component does not throw any exception, the recording keeps on going.
    Tuesday, April 16, 2013 9:52 AM
  • Hi Rob,

    The scenario is exactly as Vinicius wrote above. Imagine the user has already started the recording and during the recording process the user turns the microphone capability off. Unfortunatelly, the media capture does not throw any exception and is useless handle the media capture Failed event.

    Regards,

    Celso


    Friday, April 19, 2013 9:17 PM
  • In what way is handling the Failed event useless?

    It appears to work fine for me as demonstrated in the Media capture using capture device sample.

    --Rob

    Tuesday, April 23, 2013 11:09 PM
    Moderator
  • Unfortunately, using that method can lead to WACK test failure:

    http://social.msdn.microsoft.com/Forums/windowsapps/en-US/3ede3b3b-fe05-4b97-bf11-baa667485d0a/app-failing-wack-test-because-of-microphone-use?forum=winappswithcsharp

    My code attempts to open the mic immediately, and as a result initially throws up the system permission request, blocking my UI.

    Any suggestions on a workaround?


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Friday, January 10, 2014 9:51 AM