Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ - (NSString *)formatPorts:(NSArray<AVAudioSessionPortDescription *> *)ports;

@end

// Bit positions from AVAudioSessionTypes.h. Using masks instead of enum case names avoids build breaks when
// earlier sdks shipped with Xcode do not see certain options
// todo: remove when most common eas xcode images will be shipped with needed xcode versions
// https://docs.expo.dev/build-reference/infrastructure/#ios-server-images
static const AVAudioSessionCategoryOptions
RNAudioSessionCategoryOptionBluetoothHighQualityRecordingMask = 1 << 19;
static const AVAudioSessionCategoryOptions RNAudioSessionCategoryOptionFarFieldInputMask = 1 << 18;

@implementation AudioSessionManager

static AudioSessionManager *_sharedInstance = nil;
Expand Down Expand Up @@ -451,7 +459,8 @@ - (AVAudioSessionMode)modeFromString:(NSString *)modeSTR
mode = AVAudioSessionModeDefault;
} else if ([modeSTR isEqualToString:@"dualRoute"]) {
if (@available(iOS 26.2, *)) {
mode = AVAudioSessionModeDualRoute;
// under the hood, its only string, refer to lines at the top of the file for more info
mode = (AVAudioSessionMode) @"AVAudioSessionModeDualRoute";
} else {
mode = AVAudioSessionModeDefault;
}
Expand All @@ -462,8 +471,9 @@ - (AVAudioSessionMode)modeFromString:(NSString *)modeSTR
} else if ([modeSTR isEqualToString:@"moviePlayback"]) {
mode = AVAudioSessionModeMoviePlayback;
} else if ([modeSTR isEqualToString:@"shortFormVideo"]) {
if (@available(iOS 26, *)) {
mode = AVAudioSessionModeShortFormVideo;
if (@available(iOS 26.0, *)) {
// under the hood, its only string, refer to lines at the top of the file for more info
mode = (AVAudioSessionMode) @"AVAudioSessionModeShortFormVideo";
} else {
mode = AVAudioSessionModeDefault;
}
Expand Down Expand Up @@ -503,8 +513,9 @@ - (AVAudioSessionCategoryOptions)optionsFromArray:(NSArray *)optionsArray
}

if ([option isEqualToString:@"bluetoothHighQualityRecording"]) {
if (@available(iOS 26, *)) {
options |= AVAudioSessionCategoryOptionBluetoothHighQualityRecording;
if (@available(iOS 26.0, *)) {
// not available in the european union
options |= RNAudioSessionCategoryOptionBluetoothHighQualityRecordingMask;
}
continue;
}
Expand All @@ -521,9 +532,9 @@ - (AVAudioSessionCategoryOptions)optionsFromArray:(NSArray *)optionsArray

if ([option isEqualToString:@"farFieldInput"]) {
if (@available(iOS 26.2, *)) {
options |= AVAudioSessionCategoryOptionFarFieldInput;
continue;
options |= RNAudioSessionCategoryOptionFarFieldInputMask;
}
continue;
}

if ([option isEqualToString:@"interruptSpokenAudioAndMixWithOthers"]) {
Expand Down
Loading