Wednesday, October 28, 2026
HomeiOS Developmentios - Stop AVAudioRecorder from selecting up AVPlayer's Audio

ios – Stop AVAudioRecorder from selecting up AVPlayer’s Audio

[ad_1]

I’ve an AVPlayer that performs a video. I’ve an AVAudioRecorder that I take advantage of to document totally different audio clips by way of the mic. Whereas recording, I do not need to decide up the audio from the video so I take advantage of:

strive AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .spokenAudio, choices: .defaultToSpeaker)
strive AVAudioSession.sharedInstance().setActive(true)

Once I’m recording utilizing the recorder, it is nonetheless selecting up the sound from the avplayer’s video.

How can I preserve the the AVAudioRecorder from selecting up the AVPlayer’s sound?

For somewhat extra context. I ultimately merge the recorded audio clips with the video utilizing a mixComposition into a brand new video. The tip result’s the brand new video has the audio clips taking part in over the video (a narration) with the video’s authentic audio observe nonetheless in place.

Is that this a scenario the place I would like to make use of AVAudioEngine or AVCaptureSession/AVCaptureAudioDataOutput?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments