Update iOS audio session handling#317
Conversation
🦋 Changeset detectedLatest commit: 5892cda The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Ideally we should throw (at publish) when the audio engine fails to start (e.g. audio session activation failure), similar to how the Swift SDK's startLocalRecording() / checkAdmResult() handles this. But that can be a separate PR. |
davidliu
left a comment
There was a problem hiding this comment.
LGTM, is this ready to go? I'll do some local testing on it today and merge it later if it's good.
Couple things to do:
- Add a changeset (
yarn changeset), this should be a minor patch. - Update the USAGE.md to add the
setupIOSAudioManagement()call (could this just be moved into registerGlobals() without any side effects)?
|
Thanks @davidliu , I better do more manual/device testing also today 🙂 |
|
Currently blocked by "double voice processing" issue.. |
|
Currently waiting for livekit/react-native-webrtc#81 to ship. |
The effect depended on onConfigureNativeAudio, so inline-arrow callers re-ran cleanup+setup on every render, re-registering native audio engine handlers and resetting audioEngineState mid-session (losing enable/disable edge detection). Move the callback into a ref assigned during render and reduce the setup effect deps to [preferSpeakerOutput].
Bundle of comment-only changes: - Fix JSDoc on setupIOSAudioManagement (remove stale hook pointer) - Restore TODO context above iosPIP @ts-expect-error in VideoTrack - Note compiler-version gating on .allowBluetoothHFP in Swift init - Clarify AudioTrackState deprecation message - Document engine-state mapping shift in legacy useIOSAudioManagement - Cross-reference paired default audio configuration helpers
# Conflicts: # src/index.tsx
Migrate audio handling similar to Swift
Requires livekit/react-native-webrtc#62