Skip to content

Conversation

@michalsek
Copy link
Member

@michalsek michalsek commented Jan 28, 2026

Closes #734

⚠️ Breaking changes ⚠️

  • removed deprecated allowBluetooth session option in favor of allowBluetoothHFP

Introduced changes

  • removes deprecated allowBluetooth session option in favor of allowBluetoothHFP
  • adds setInput method to audio api module and session manager
  • adds simple react hook for easy usage

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web
  • Updated old arch android spec file

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds input device selection functionality to the audio API and fixes iOS Bluetooth category naming. The main purpose is to allow users to programmatically select audio input devices (e.g., switching between built-in microphone and Bluetooth devices) in response to issue #734.

Changes:

  • Added setInputDevice method to AudioManager for selecting input devices
  • Renamed iOS option from allowBluetooth to allowBluetoothHFP for correct Bluetooth profile
  • Added useAudioInput React hook for managing input device selection with automatic updates on route changes

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/react-native-audio-api/tsconfig.json Added module suffixes for better native/web resolution
packages/react-native-audio-api/src/web-system/AudioManager.ts Added setInputDevice mock for web platform
packages/react-native-audio-api/src/system/types.ts Added uid field to AudioDeviceInfo, renamed allowBluetooth to allowBluetoothHFP, added setInputDevice to interface
packages/react-native-audio-api/src/system/AudioManager.ts Implemented setInputDevice method, reordered imports
packages/react-native-audio-api/src/specs/NativeAudioAPIModule.web.ts Added setInputDevice method to web spec
packages/react-native-audio-api/src/specs/NativeAudioAPIModule.ts Added setInputDevice to native spec, added non-null assertion
packages/react-native-audio-api/src/index.ts Exported hooks from package entry point
packages/react-native-audio-api/src/hooks/useSystemVolume.ts Updated import to use AudioManager from api module
packages/react-native-audio-api/src/hooks/useAudioInput.ts New hook for managing audio input device selection
packages/react-native-audio-api/src/hooks/index.ts Created hooks barrel export file
packages/react-native-audio-api/src/events/types.ts Extracted InterruptionType and RouteChangeReason as exported types
packages/react-native-audio-api/src/api.ts Reorganized exports, removed useSystemVolume export
packages/react-native-audio-api/ios/audioapi/ios/system/AudioSessionManager.mm Implemented setInputDevice, added uid to device info, changed allowBluetooth to allowBluetoothHFP
packages/react-native-audio-api/ios/audioapi/ios/system/AudioSessionManager.h Added setInputDevice method declaration
packages/react-native-audio-api/ios/audioapi/ios/AudioAPIModule.mm Exposed setInputDevice to React Native bridge
packages/react-native-audio-api/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotificationReceiver.kt Added blank lines for formatting consistency
packages/react-native-audio-api/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt Added setInputDevice stub (no-op pending duplex stream implementation)
packages/audiodocs/docs/system/audio-manager.mdx Updated documentation for renamed Bluetooth option
packages/audiodocs/docs/react/select-input.mdx Added documentation for new useAudioInput hook
packages/audiodocs/docs/react/category.json Created React hooks documentation category
apps/fabric-example/ios/Podfile.lock Updated hermes-engine hash
apps/common-app/src/examples/Record/Record.tsx Added device selection UI, updated to use allowBluetoothHFP

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

michalsek and others added 3 commits January 29, 2026 17:26
@michalsek michalsek marked this pull request as ready for review February 3, 2026 12:36
Copy link
Contributor

@poneciak57 poneciak57 left a comment

Choose a reason for hiding this comment

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

Good job 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select input device for recording?

3 participants