0

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

Eeshwar
  • 277
  • 3
  • 17
HariKarthick
  • 1,369
  • 1
  • 19
  • 47
  • Is it because without the headphone, the music is coming out the speaker and so it is being recorded by the mic. But when you have headphones the phone cant hear it so it wont record it? Just a guess. – Eeshwar Nov 08 '16 at 11:00
  • Thankyou for your comment.Ya it's true.Is there any solution for that? – HariKarthick Nov 08 '16 at 11:51
  • The only solution I can think of is to merge the 2 audio files after the recording has finished if the user was using headphones. Check out this post for help: http://stackoverflow.com/questions/11596945/how-to-merge-two-mp3-files-ios – Eeshwar Nov 08 '16 at 11:55
  • Thankyou for your response.. Do you have any idea to find the itunes music library path.Check out this post if you are free:http://stackoverflow.com/questions/40480378/how-to-upload-audio-songs-into-server-using-swift-ios – HariKarthick Nov 08 '16 at 12:05
  • Any other solution for hear recorded music in headphone? – HariKarthick Nov 10 '16 at 07:14

1 Answers1

0

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

Community
  • 1
  • 1
Eeshwar
  • 277
  • 3
  • 17