Skip to content

Commit

Permalink
Fix an issue where the no-op recording mechanism was erroring on star…
Browse files Browse the repository at this point in the history
…t, resulting in the app not staying alive in the background after joining a call with cam + mic initially off.
  • Loading branch information
kompfner committed Aug 23, 2023
1 parent 31ea3d7 commit 0a2c639
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ios/RCTWebRTC/WebRTCModule+Daily.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ - (void)audioSession:(RTCAudioSession *)audioSession willSetActive:(BOOL)active
// Expects to be invoked from captureSessionQueue
- (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;
// Note: we *used* to have the following line:
// captureSession.automaticallyConfiguresApplicationAudioSession = NO;
// The original reason for it was to "prevent configuration 'thrashing' once
// WebRTC audio unit takes the reins." As of 2023-08-23, I (kompfner) haven't
// observed any audio misbehavior as a result of removing this line. Keeping
// this line, on the other hand, was causing the no-op recording to error on
// start, which in turn meant that your app would not stay alive in the
// background if you joined a call with you cam and mic initially off.
AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
if (!audioDevice) {
return nil;
Expand Down

0 comments on commit 0a2c639

Please sign in to comment.