2
  1. Start publishing to a session, notice that Android OS now reports that camera and microphone is being used by the app, which is fine.

image

  1. Call session.onPause() followed by publisher.publishAudio = false.
  2. (Optional) Move application into background by pressing Home button.
  3. Android OS indicates that camera is no longer being used, but microphone is still being used by the application.

image

Although it does not affect usability of the app it is bad in terms of user privacy perspective - the user might think the app is still recording audio while it is in background, which is scary.

Is there other methods I can call to turn off the microphone access totally, just like the camera?

Bruce
  • 2,357
  • 5
  • 29
  • 50
  • The camera will be released immediately when the app is put to the background( session.onPause()) and microphone will be used by the app for approximately 1 minute because audio will be continue to flow for about 1 minute after the app is put in background. The audio flow stops after 1 minute and microphone will no longer be used by the app. I am however going to see if there is a way that we can expose the option to instantly shut off the audio stream when you use onPause. – DevWithZachary Apr 01 '22 at 07:21
  • For debugging purposes it would be useful if you can include in your question sample code on how you are initialising the session. – DevWithZachary Apr 01 '22 at 08:04
  • @DevWithZachary thanks for the info! Yes if there is a way to instantly shut off audio stream onPause that would be perfect :) – Bruce Apr 01 '22 at 09:40

1 Answers1

2

Got a reply from Tokbox support and they provided a tweak that works as expected!

For your use case, where you don't want to retain the audio access when the app goes into the background, you can try to call AudioDeviceManager.getAudioDevice().stopCapturer() to stop the capturer and it will remove the microphone access. If you do this, please make sure to call AudioDeviceManager.getAudioDevice().startCapturer() when the app comes in the foreground.

DevWithZachary
  • 3,545
  • 11
  • 49
  • 101
Bruce
  • 2,357
  • 5
  • 29
  • 50