Skip to content

Conversation

@michalsek
Copy link
Member

@michalsek michalsek commented Oct 20, 2025

Closes RNAA-289, RNAA-291, RNAA-334, RNAA-360

⚠️ Breaking changes ⚠️

  • AudioRecorder constructor no longer accepts any options
  • onAudioReady now requires additional properties passed, that define data received by the callback - desired chunk length, channel count, sample rate

Introduced changes

  • Adds option to record to files and makes audio callback optional
  • Smaller fixes around types and their exposure
  • Fixes issue with showing iOS lock screen controls while using only recorder
  • fixes eslint & ts setup
  • fixes issue with setSessionActive always resolving to true no mather if it was succesfull or not
  • slightly refactors of how session options are handled as well as how recorder communicates with the audio engine
  • fixes issue with recorder enforcing sample rate (thus audio output quality) on the playback

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

@gabimoncha
Copy link
Contributor

big if true 🤘🏼

@software-mansion software-mansion deleted a comment from michalsek Dec 4, 2025
Comment on lines +241 to +248
template<typename TNew>
[[nodiscard]] std::enable_if_t<!std::is_void_v<T>, Result<TNew, E>> map(std::function<TNew(T&&)> ok_func) && {
if (is_ok_) {
return Result<TNew, E>::Ok(ok_func(std::move(ok_value)));
} else {
return Result<TNew, E>::Err(std::move(err_value));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
template<typename TNew>
[[nodiscard]] std::enable_if_t<!std::is_void_v<T>, Result<TNew, E>> map(std::function<TNew(T&&)> ok_func) && {
if (is_ok_) {
return Result<TNew, E>::Ok(ok_func(std::move(ok_value)));
} else {
return Result<TNew, E>::Err(std::move(err_value));
}
}
template <typename Type>
using isNotVoid = std::enable_if_t<!std::is_void_v<Type>>
template<typename TNew, typename = isNotVoid<TNew>>
[[nodiscard]] Result<TNew, E> map(std::function<TNew(T&&)> ok_func) && {
if (is_ok_) {
return Result<TNew, E>::Ok(ok_func(std::move(ok_value)));
} else {
return Result<TNew, E>::Err(std::move(err_value));
}
}

and we can utilize isNotVoid and this template syntax in all following cases for more readability

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 pull request introduces audio recording to file capabilities for the AudioRecorder API with significant breaking changes. The PR refactors the AudioRecorder constructor to no longer accept options, makes the audio callback optional, and adds comprehensive file recording support with multiple formats (WAV, CAF, M4A, FLAC) across both iOS and Android platforms.

Key Changes

  • Refactored AudioRecorder API with breaking changes to constructor and callbacks
  • Added file recording with configurable formats, quality presets, and output directories
  • Fixed iOS lock screen controls appearing when only using the recorder
  • Improved audio session and engine state management
  • Added pause/resume functionality for recordings
  • Updated ESLint and TypeScript configurations

Reviewed changes

Copilot reviewed 109 out of 117 changed files in this pull request and generated no comments.

Show a summary per file
File Description
yarn.lock Updated dependencies including commitlint, React Navigation, and TypeScript eslint packages
tsconfig.json Added removeComments: false compiler option
prettier.config.js Added deprecated jsxBracketSameLine option
packages/react-native-audio-api/src/types.ts Added file recording types, presets, and Result type
packages/react-native-audio-api/src/utils/filePresets.ts New file defining audio quality presets
packages/react-native-audio-api/src/core/AudioRecorder.ts Complete refactor with file output, callbacks, and state management
packages/react-native-audio-api/src/api.ts Reorganized exports and added FilePreset
packages/react-native-audio-api/src/interfaces.ts Updated IAudioRecorder interface with new methods
packages/react-native-audio-api/ios/**/*.mm iOS native implementation for file writing, callbacks, and improved state management
packages/react-native-audio-api/android/**/*.kt Android system integration updates
packages/react-native-audio-api/android/**/*.cpp Android FFmpeg and miniaudio file writer implementations
packages/react-native-audio-api/common/cpp/** Shared C++ implementation for recorders, file writers, and callbacks

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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants