Optional playback-only iOS build without microphone APIs

Đang mở
#1,398 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, ios, objective-c, react-native, swift

Hướng nghiên cứu

Start by reviewing the attached v0.13.6 patch and the iOS recorder implementations named in the issue: IOSAudioRecorder, NativeAudioRecorder, IOSRecorderCallback, and AudioRecorderHostObject. Trace how the iOS build is configured for CocoaPods, Swift Package Manager, and Expo config plugins, then define and verify the disabled build behavior: playback and synthesis remain available, while recording requests return an unsupported-operation error. The issue reports a working local proof of concept but no comprehensive validation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature-request ios
Feature Request
Problem

Some applications use react-native-audio-api exclusively for audio playback and synthesis, without requiring microphone input or audio recording.

However, the iOS binary still includes recording-related implementations and references to microphone permission APIs, even when the application never uses these features.

This can complicate App Store privacy audits and introduces native functionality that is unnecessary for playback-only applications.

Proposed solution

Introduce an optional build-time configuration to disable audio recording on iOS.

For example:

RNAudioAPI_ENABLE_RECORDING=false

The option would:

  • Exclude iOS recorder implementations from compilation.
  • Remove references to microphone permission request/check APIs from the playback-only build.
  • Preserve audio playback, synthesis, decoding, and the existing audio engine.
  • Return a clear unsupported-operation error if recording is requested.
  • Keep recording enabled by default for full backward compatibility.

Ideally, the configuration would support CocoaPods, Swift Package Manager, and Expo config plugins.

Existing implementation

I maintain a React Native application that uses this library exclusively for synthesized workout audio cues.

For react-native-audio-api 0.13.6, I implemented a local Yarn patch that:

  • Excludes IOSAudioRecorder, NativeAudioRecorder, IOSRecorderCallback, and AudioRecorderHostObject implementations from the iOS CocoaPods build.
  • Removes calls to AVAudioApplication / AVAudioSession microphone permission APIs.
  • Preserves the JSI recorder factory but makes recording attempts fail explicitly.
  • Uses MA_NO_DEVICE_IO=1 for miniaudio while retaining decoding and playback through AVAudioEngine.

The patched version builds and runs on iOS, and audio playback works. This is not yet a comprehensive validation of every audio scenario.

Related implementation patterns

I have implemented optional native build configurations in two other React Native libraries:

react-native-file-hash

https://github.com/Preeternal/react-native-file-hash

Supports build-time engine selection across Android, CocoaPods, SwiftPM, and Expo, compiling and linking only the selected implementation.

react-native-document-scanner-plugin

https://github.com/Preeternal/react-native-document-scanner-plugin

Supports optional Android analysis features through Gradle properties and an Expo config plugin.

Contribution

Would you be interested in supporting an optional playback-only iOS build?

I’ve attached my current Yarn patch against v0.13.6 as a proof of concept. It is application-specific and not intended as a ready-to-merge solution, but it demonstrates the changes needed for a playback-only iOS build. I’m happy to help adapt it into a configurable upstream implementation.

react-native-audio-api-npm-0.13.6-3169d14b69.patch

Ngôn ngữ chính
C++
Star
856
Fork
100
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
34

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của software-mansion/react-native-audio-api

Tất cả issue của software-mansion/react-native-audio-api

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.