Skip to content

[Blocked] refactor: updated AVAudioSessionCategoryOptions #558

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/Record/Record.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Record: FC = () => {
AudioManager.setAudioSessionOptions({
iosCategory: 'playAndRecord',
iosMode: 'spokenAudio',
iosOptions: ['allowBluetooth', 'defaultToSpeaker'],
iosOptions: ['allowBluetoothHFP', 'defaultToSpeaker'],
});

recorderRef.current = new AudioRecorder({
Expand Down
5 changes: 3 additions & 2 deletions packages/audiodocs/docs/system/audio-manager.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function App() {
AudioManager.setAudioSessionOptions({
iosCategory: 'playback',
iosMode: 'default',
iosOptions: ['allowBluetooth', 'allowAirPlay'],
iosOptions: ['allowBluetoothHFP', 'allowAirPlay'],
})

// set info for track to be visible while device is locked
Expand Down Expand Up @@ -230,7 +230,8 @@ type IOSOption =
| 'duckOthers'
| 'allowAirPlay'
| 'mixWithOthers'
| 'allowBluetooth'
| 'allowBluetoothHFP'
| 'bluetoothHighQualityRecording'
| 'defaultToSpeaker'
| 'allowBluetoothA2DP'
| 'overrideMutedMicrophoneInterruption'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ - (void)setAudioSessionOptions:(NSString *)category
sessionOptions |= AVAudioSessionCategoryOptionMixWithOthers;
}

if ([option isEqualToString:@"allowBluetooth"]) {
sessionOptions |= AVAudioSessionCategoryOptionAllowBluetooth;
if ([option isEqualToString:@"allowBluetoothHFP"]) {
sessionOptions |= AVAudioSessionCategoryOptionAllowBluetoothHFP;
}

if (@available(iOS 26.0, *) && [option isEqualToString:@"bluetoothHighQualityRecording"]) {
sessionOptions |= AVAudioSessionCategoryOptionBluetoothHighQualityRecording;
}

if ([option isEqualToString:@"defaultToSpeaker"]) {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-audio-api/src/system/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type IOSOption =
| 'duckOthers'
| 'allowAirPlay'
| 'mixWithOthers'
| 'allowBluetooth'
| 'allowBluetoothHFP'
| 'bluetoothHighQualityRecording'
| 'defaultToSpeaker'
| 'allowBluetoothA2DP'
| 'overrideMutedMicrophoneInterruption'
Expand Down
Loading