HariKarthick HariKarthick - 26 days ago 24
Swift Question

Why don't hear music after recording in swift?

I'm making a karaoke application. If the headphones aren't plugged in, my app works fine. (my voice and background music record together). It is successful, but when I do the same way with headphone then I listen to the recording. I can't hear the background music, but I hear the voice clearly. I attached the code below I used:

https://github.com/genedelisa/AVFoundationRecorder

Answer

The issue is that when the headphones are plugged in, the mic is not able to pick up and record the audio, only your voice. Obviously, when the headphones are not plugged in, this is not an issue.

I would recommend that you combine the music and the voice recording after the voice is recorded if the user was using headphones. Suggestions on how to do that can be found on this post: How to merge two mp3 files iOS?

Also, to check if headphones are plugged in check out this post: Are headphones plugged in? iOS7

Comments