Skip to content

Audio recording perms check at lib#793

Merged
hiroshihorie merged 4 commits intomainfrom
hiroshi/lib-recording-perms-check
Sep 29, 2025
Merged

Audio recording perms check at lib#793
hiroshihorie merged 4 commits intomainfrom
hiroshi/lib-recording-perms-check

Conversation

@hiroshihorie
Copy link
Copy Markdown
Member

@hiroshihorie hiroshihorie commented Sep 23, 2025

Move audio recording perms checks from SDK to WebRTC.
Patch: webrtc-sdk/webrtc#200

A simple way to test this would be trying to enable mic while in a phone call.
AVAudioSession activation fail will be detected in the lib, and report error instead of crashing.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 23, 2025

⚠️ This PR does not contain any files in the .changes directory.

Copy link
Copy Markdown
Contributor

@pblazej pblazej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a normal call, there's no difference in the error codes/logs:

// Before
2025-09-29T10:07:12+0200 debug LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession configuring category to: AVAudioSessionCategory(_rawValue: AVAudioSessionCategoryPlayAndRecord)
2025-09-29T10:07:12+0200 debug LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession activating...
2025-09-29T10:07:12+0200 error LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession failed to activate AudioSession with error: Error Domain=NSOSStatusErrorDomain Code=561017449 "Session activation failed" UserInfo={NSLocalizedDescription=Session activation failed}
2025-09-29T10:07:12+0200 debug LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession activationCount: 0, webRTCSessionCount: 0
2025-09-29T10:07:12+0200 debug LiveKitSDK: [LiveKit] AudioDeviceModuleDelegateAdapter.audioDeviceModule(_:willEnableEngine:isPlayoutEnabled:isRecordingEnabled:) AudioEngine pre-enable check, device permission: true
2025-09-29T10:07:12+0200 debug LiveKitSDK: [LiveKit] AudioDeviceModuleDelegateAdapter.audioDeviceModule(_:willEnableEngine:isPlayoutEnabled:isRecordingEnabled:) AudioEngine pre-enable check, audio session: AVAudioSessionCategoryPlayAndRecord


// After
2025-09-29T10:09:48+0200 debug LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession configuring category to: AVAudioSessionCategory(_rawValue: AVAudioSessionCategoryPlayAndRecord)
2025-09-29T10:09:48+0200 debug LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession activating...
2025-09-29T10:09:48+0200 error LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession failed to activate AudioSession with error: Error Domain=NSOSStatusErrorDomain Code=561017449 "Session activation failed" UserInfo={NSLocalizedDescription=Session activation failed}
2025-09-29T10:09:48+0200 debug LiveKitSDK: [LiveKit] AudioSessionEngineObserver.configure(oldState:newState:) AudioSession activationCount: 0, webRTCSessionCount: 0

It does not crash either...

@hiroshihorie hiroshihorie merged commit 3f19afc into main Sep 29, 2025
17 of 24 checks passed
@hiroshihorie hiroshihorie deleted the hiroshi/lib-recording-perms-check branch September 29, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants