Weird AV behavior when headphones are plugged in

I have a karaoke app that streams mov files. One of the features in my app is recording. In order to accomplish that I download the streamed file in the background and then commence audio recording to capture user audio. Once the user is done I take the recorded audio and merge it with the mov file i previously downloaded in the background. All of this is working well except for when you plug in headphones. The experience is the same but when you go to playback the recording only the audio was captured. The mov file never makes it into the final asset and I don’t understand why.

Here is how I am producing the recording:

What gives?