nesterenkodm / pjsip

PJSIP is Open Source SIP, Media, and NAT Traversal Library
495 stars 220 forks source link

Microphone permission #89

Closed aleksandrach closed 5 years ago

aleksandrach commented 5 years ago

I would like to know if there are some methods to handle the microphone permission. I am using version 2.5.5.6.

welljsjs commented 5 years ago

Hi @aleksandrach

Indeed, there are, if you're talking about iOS (I am not too sure about macOS).

This reference article might be useful for you: https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_ios#2962313

Does that meet your needs?

aleksandrach commented 5 years ago

Thanks for the answer. I was thinking about some method that we can use for showing this popup. As I understand, currently the microphone permission popup is presented automatically by the pjsip library.

welljsjs commented 5 years ago

No, pjsip actually does nothing like that by itself.

On iOS, you can't force to show popups like that. If something requires certain permissions, iOS itself will present such an alert.

So what you should probably do is to add the key mentioned in the article to your Info.plist file and request authorisation if necessary (meaning if you'd like to ask for permission in advance, for what reason ever, maybe during the initial configuration of the application) as shown below. If you don't explicitly tell iOS to ask for permission, the OS will automatically show the popup when any process tries to access any resource that requires a certain level of authorisation.

To make it clear, there's no need to manually recreate and present a popup that asks for permissions.

aleksandrach commented 5 years ago

Thanks, I will check.

welljsjs commented 5 years ago

Feel free to reopen if necessary, I'll close this for now as you didn't respond within five days. No further action needed.