-
-
Notifications
You must be signed in to change notification settings - Fork 34
AudioRecorder - recording to file #752
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
base: main
Are you sure you want to change the base?
Conversation
|
big if true 🤘🏼 |
...ages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/utils/FileOptions.cpp
Show resolved
Hide resolved
...ages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/utils/FileOptions.cpp
Show resolved
Hide resolved
packages/react-native-audio-api/ios/audioapi/ios/system/NotificationManager.mm
Show resolved
Hide resolved
packages/react-native-audio-api/ios/audioapi/ios/core/utils/FileWriter.mm
Outdated
Show resolved
Hide resolved
...pi/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp
Show resolved
Hide resolved
...pi/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp
Outdated
Show resolved
Hide resolved
…android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp Co-authored-by: Michał Dydek <54865962+mdydek@users.noreply.github.com>
...udio-api/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.cpp
Show resolved
Hide resolved
packages/react-native-audio-api/ios/audioapi/ios/core/IOSAudioRecorder.mm
Outdated
Show resolved
Hide resolved
...s/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp
Outdated
Show resolved
Hide resolved
...s/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp
Outdated
Show resolved
Hide resolved
...s/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp
Outdated
Show resolved
Hide resolved
...s/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp
Outdated
Show resolved
Hide resolved
...s/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp
Outdated
Show resolved
Hide resolved
...s/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp
Outdated
Show resolved
Hide resolved
| 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)); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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
There was a problem hiding this 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.
Closes RNAA-289, RNAA-291, RNAA-334, RNAA-360
AudioRecorderconstructor no longer accepts any optionsonAudioReadynow requires additional properties passed, that define data received by the callback - desired chunk length, channel count, sample rateIntroduced changes
setSessionActivealways resolving to true no mather if it was succesfull or notChecklist