-
-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Description I am experiencing an issue where the AnalyserNode fails to capture any audio data on Android 16, specifically on a Redmi device. While the system's microphone privacy indicator is visible (confirming the mic is active), the frequency data buffer remains entirely filled with zeros.
This exact same code works perfectly on Android 12.
Environment
Framework: Expo 55 (React Native)
Library: react-native-audio-api
Device: Redmi (Xiaomi)
OS Version: Android 16 (API Level 36)
Permissions: RECORD_AUDIO is granted.
Steps to Reproduce
Initialize AudioContext and AnalyserNode.
Connect AudioRecorder to the AnalyserNode via createRecorderAdapter.
Start recording.
Call analyser.getByteFrequencyData(rawData).
Observed Behavior The rawData array is always [0, 0, 0, ...] and avgEnergy is always 0, even when there is loud input. The waveform remains flat.
Expected Behavior The AnalyserNode should provide real-time frequency data, matching the behavior on Android 12.
Code Snippet
TypeScript
const rawData = new Uint8Array(analyserRef.current.frequencyBinCount);
analyserRef.current.getByteFrequencyData(rawData);
// rawData is consistently [0, 0, 0...] on Android 16
Additional Context (Potential Causes)
Android 16 Foreground Service Policy: Does the library handle the new FOREGROUND_SERVICE_MICROPHONE requirements for API 34+ correctly?
AudioContext Lifecycle: On Android 16, does the AudioContext require a specific user-interaction trigger or a different sampleRate initialization?
Hardware-Specific: This was observed on a Redmi device; there might be a specific interaction with MIUI/HyperOS on the Android 16 base.
Is there any workaround or an updated configuration required for Android 16 support?