Skip to content
Merged
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
14 changes: 14 additions & 0 deletions package/native-package/src/optionalDependencies/Audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ class _Audio {
audioSet: {
// Android specific properties
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
// Pin nitro-sound 0.2.10+'s bitrate to 128 kbps. Its `.high` quality
// preset otherwise defaults to (48 kHz, 2ch, 192 kbps), a combination
// the iOS hardware AAC encoder rejects with
// kAudioFormatUnsupportedDataFormatError ('fmt?', OSStatus 1718449215)
// in AppStore signed binaries.
// https://www.osstatus.com/search/results?search=1718449215
// Older nitro-sound and the legacy `react-native-audio-recorder-player`
// ignore this key.
AudioEncodingBitRate: 128000,
AudioSourceAndroid: AudioSourceAndroidType.MIC,
OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,

Expand All @@ -121,6 +130,11 @@ class _Audio {
? AVModeIOSOptionNitroSound.spokenaudio
: AVModeIOSOption.spokenaudio,
AVNumberOfChannelsKeyIOS: 2,
// Pair with `AudioEncodingBitRate` above override nitro-sound 0.2.10+'s
// 48 kHz default back to 44.1 kHz so the encoder gets the combo that
// 0.2.9 was implicitly using. Idempotent for older nitro-sound and the
// legacy lib (their default is already 44.1 kHz).
AVSampleRateKeyIOS: 44100,
},
isMeteringEnabled: true,
},
Expand Down
9 changes: 9 additions & 0 deletions package/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ type AVEncodingType =
export interface AudioSet {
AudioChannelsAndroid?: number;
AudioEncoderAndroid?: AudioEncoderAndroidType;
/**
* Cross-platform bitrate hint introduced in `react-native-nitro-sound` 0.2.10+.
* Sits alongside the iOS-native `AVEncoderBitRateKeyIOS` because nitro-sound
* reads `AudioEncodingBitRate` on iOS (mapping it to `AVEncoderBitRateKey`),
* not the platform-specific key. Older nitro-sound builds and the legacy
* `react-native-audio-recorder-player` ignore this field, so it's safe to
* include unconditionally.
*/
AudioEncodingBitRate?: number;
AudioEncodingBitRateAndroid?: number;
AudioSamplingRateAndroid?: number;
AudioSourceAndroid?: AudioSourceAndroidType;
Expand Down