From 46965631c671ac5ed18f128b9737763186b993fa Mon Sep 17 00:00:00 2001 From: gaetano <64538010+skrtdev@users.noreply.github.com> Date: Thu, 21 May 2026 13:04:47 +0200 Subject: [PATCH] fix(ios): don't mix recording with other apps' audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AVAudioSession options used when configuring a recording session currently include .mixWithOthers, which keeps other audio apps (Spotify, Apple Music, Podcasts, …) playing through the speaker during the recording. The microphone picks that audio up and bleeds it into the recorded file — turning every voice recording into a mix of the user's voice and whatever music was playing. Drop .mixWithOthers from the recorder session so starting a recording interrupts other audio. Recording should always own the audio route exclusively. The player session (AudioPlayer.swift) is unrelated and not touched here. --- ios/AudioRecorder.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/AudioRecorder.swift b/ios/AudioRecorder.swift index d571ca0..d5c15f2 100644 --- a/ios/AudioRecorder.swift +++ b/ios/AudioRecorder.swift @@ -45,7 +45,13 @@ public class AudioRecorder: NSObject, AVAudioRecorderDelegate{ AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue ] - let options: AVAudioSession.CategoryOptions = [.defaultToSpeaker, .allowBluetooth, .mixWithOthers] + // Don't pass .mixWithOthers when configuring an audio-recording session: + // mixing means other apps (Spotify, Apple Music, Podcasts, …) keep + // playing through the speaker while recording, and that audio bleeds + // straight into the recorded file via the device microphone. Starting + // a recording should interrupt other audio so the mic captures only the + // user's voice. + let options: AVAudioSession.CategoryOptions = [.defaultToSpeaker, .allowBluetooth] if (path == nil) { guard let newPath = self.createAudioRecordPath(fileNameFormat: fileNameFormat) else {