Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS permissions triggered too early #41

Open
moulie415 opened this issue Jun 22, 2023 · 1 comment
Open

iOS permissions triggered too early #41

moulie415 opened this issue Jun 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@moulie415
Copy link
Contributor

This seems to be an issue with the daily js forked version of react native webrtc and specifically this function

- (AVCaptureSession *)configuredCaptureSession {
  AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];
  // Don't automatically configure application audio session, to prevent
  // configuration "thrashing" once WebRTC audio unit takes the reins.
  captureSession.automaticallyConfiguresApplicationAudioSession = NO;
  AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
  if (!audioDevice) {
    return nil;
  }
  NSError *inputError;
  AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&inputError];
  if (inputError) {
    return nil;
  }
  if ([captureSession canAddInput:audioInput]) {
    [captureSession addInput:audioInput];
  }
  else {
    return nil;
  }
  AVCaptureAudioDataOutput *audioOutput = [[AVCaptureAudioDataOutput alloc] init];
  if ([captureSession canAddOutput:audioOutput]) {
    [captureSession addOutput:audioOutput];
  }
  else {
    return nil;
  }
  return captureSession;
}

This line AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&inputError]; seems to be the culprit and its causing the permissions to be triggered before you even unmute yourself on iOS.

@moulie415 moulie415 added the bug Something isn't working label Jun 22, 2023
@filipi87
Copy link
Contributor

Hi @moulie415,

Thanks for sharing this.

That is one of the culprits causing this behavior, but unfortunately, not the only one.

There is also this only issue, inside the webrtc framework:
Issue 5873: WebRTC framework asking for permissions to the microphone on iOS: https://bugs.chromium.org/p/webrtc/issues/detail?id=5873

Looks like on the most recent versions, after version M107, there is a possible way to fix this by providing our own version of the Audio Device Module (ADM).

There is already a task in our backlog to investigate this, and see if It is possible to fix this behavior without needing to create and keep a patch of WebRTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants