i'm developing an app which requires to play a video from an URL using MPMoviePlayerController while acquiring audio samples using AudioQueue from the microphone to further analyze them.
The problem is that I cannot record when the video starts playing (and also when it finishes). Simply the audio sampling stops. Instead, if I disable the video play, audio recording goes well. I've tried setting up an AudioSession with property kAudioSessionProperty_OverrideCategoryMixWithOthers but with no success (it returns error). Moreover I think that it's useless setting a property in AudioSession when using AudioQueue. Even setting useApplicationAudioSession = NO for MPMoviePlayerController does not give any help.
Hereby the core code where the player is created:
audioManager = [[AudioController alloc] init];
//setting AudioQueue: audio buffer, sample rate, format ID (PCM), bits per channel
audioManager.delegate = self;
[audioManager startAudioRecording]; //starts recording with AudioQueue
self.playerVC = [[[MPMoviePlayerController alloc] init] autorelease];
layerVC.view.frame = self.viewPlayer.bounds;
[self.viewPlayer addSubview:playerVC.view];
playerVC.useApplicationAudioSession = YES; //if NO nothing changes
[playerVC setContentURL:[NSURL URLWithString:@"http://www......."]];
[playerVC prepareToPlay];
[playerVC play];