FPWCSApi2Stream#play() causes the NSMicrophoneUsageDescription permission dialog to appear

ett

Member
Hi. I'm using iOS SDK 2.5.2

Code:
// It is written in NativeScript(TypeScript), but it doesn't affect the nature of the problem.
FPWCSApi2.createSessionError(sessionOptions)
  .onCallback(kFPWCSSessionStatus.Established, (session): void => {
    session.createStreamError(streamOptions).play();
  })
  .connect();
Even though it's play(), not publish(), I get a dialog to allow microphone access.
I tried to apply the stream muteAudio(), muteVideo() and record=false,display=null, but the results were the same.

I want the microphone permissions dialog to appear only using publish().
Is there a way around it?
 

Max

Administrator
Staff member
Good day.
I want the microphone permissions dialog to appear only using publish().
Is there a way around it?
Please try to remove the following keys from Info.plist (Player application for example):
Code:
    <key>NSMicrophoneUsageDescription</key>
    <string>Need microphone for publishing stream with audio</string>
    <key>NSCameraUsageDescription</key>
    <string>Need camera access for publishing stream with video</string>
 

ett

Member
Hi, Max.
Please try to remove the following keys from Info.plist (Player application for example):
No, it's necessary.
Because on some pages (like the members-only page), we do publish() using a microphone.
I don't want to ask microphone permission from a user who only plays stream.
 

Max

Administrator
Staff member
No, it's necessary.
Because on some pages (like the members-only page), we do publish() using a microphone.
I don't want to ask microphone permission from a user who only plays stream.
In this case, you should use two separate applications for publishing and playback:
- the publishing app must add NSMicrophoneUsageDescription key to Info.plist as Apple requires
- the playback app should not add this key, and microphone access will not be requested
Anyway, FPWCSApi2 does not request any permissions explicitly because Info.plist is the only place to manage permissions.
 

ett

Member
Hi, Max. I have good news.
I have found a solution of this issue.
Before calling FPWCSApi2Session#createStream, set WebRTC's default category to something other than PlayAndRecord by RTCAudioSessionConfiguration#setWebRTCConfiguration.
This will cause a microphone permission dialog only when use try to publish, not appear for play.
 

Max

Administrator
Staff member
Before calling FPWCSApi2Session#createStream, set WebRTC's default category to something other than PlayAndRecord by RTCAudioSessionConfiguration#setWebRTCConfiguration.
This will cause a microphone permission dialog only when use try to publish, not appear for play.
We raised the ticket WCS-3050 to check this.
Although, we solved the player permissions problem by patching WebRTC source code.
 

Max

Administrator
Staff member
We confirm RTCAudioSessionConfiguration#setWebRTCConfiguration tweak does not help to prevent microphone permissions request in all cases.
So WebRTC patch is the only and best solution.
 

Viktoriia

New Member
We confirm RTCAudioSessionConfiguration#setWebRTCConfiguration tweak does not help to prevent microphone permissions request in all cases.
So WebRTC patch is the only and best solution.
Hi, could you provide version of SDK which has this fix, cause even with latest version (2.6.80 from 13 Apr 2022) I still have microphone permission alert for playing stream
 

Max

Administrator
Staff member
This should be fixed at WebRTC library side, so there is no fix in SDK. Please use Info.plist tweak as mentioned above.
 
Top