 mill562
|
This is an update to issues discussed in Post 7431
If you would like to play MPMoviePlayerController Video and have speech recognition running at the same time, you can follow this method which does not require a second call to startAudioSession, any manual calls to performRouteChange, or restarting the loop (at least I don’t think it’s restarting the loop):
1) Modify the application audio session to allow for mixing between other audio sessions. This will allow speech detection to continue to happen during video playback. The following code can be added after a call to AudioSession.startAudioSession, or it can be added into AudioSession.startAudioSession (might be the safer location)
UInt32 allowMixing = 1;
OSStatus overrideMixStatus =
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers,
sizeof(allowMixing),
&allowMixing);
if (overrideMixStatus != 0) {
OpenEarsLog(@"Error %d: Unable to set OverrideCategoryMixWithOthers.",
(int)overrideMixStatus);
}
1) Set any MPMoviePlayerController you create in the application to use the applicationAudioSession. This prevents some conflicts between the PocketSphinx audio session setting and the MPMoviePlayerController audio session settings. It also stops kAudioUnitErr_CannotDoInCurrentContext errors being thrown in the AudioUnitRender in the AudioUnitRenderCallback function during video playback.
moviePlayerController.useApplicationAudioSession = NO;
When this could be useful:
-Allowing a user to pause a video while wearing headphone w/ mic (or without headphones but that might be problematic with the video audio being picked up by the mic).
-Allowing a user to mute the video playing through the speaker and then perform a voice command while a video is still playing.
NOTE: As discussed in 7431, I originally believed that a manual call to performRouteChange was necessary. After Halle showed much patience and discussed the situation at length with me, I dove deeper into the issue and discovered a call to performRouteChange, as well as a second call to startAudioSession, were not needed at all for this to work.
|
 Halle
|
This looks very promising and when I next get some time I will do some testing and see if some or all of it can be integrated with the library code so this is handled better out of the box, thanks.
|
 Halle
|
Quick question, is this just a typo:
Set any MPMoviePlayerController you create in the application to use the applicationAudioSession.
followed by this code:
moviePlayerController.useApplicationAudioSession = NO;
?
|