AudioStreamer playback from ear-speaker instead of bottom speaker on iPhone

954 views Asked by At

I'm using Matt Gallagher's awesome AudioStreamer example to play an audio file via AudioSession. All works, except that on my iPhone 4 I get audio playback out of my bottom speaker, and not the ear speaker. I inserted the following code to no avail.

UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_None;

        AudioSessionSetProperty (
                                 kAudioSessionProperty_OverrideAudioRoute,
                                 sizeof (audioRouteOverride),
                                 &audioRouteOverride
                                 );
1

There are 1 answers

0
ambertch On BEST ANSWER

http://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/AudioSessionServicesReference/Reference/reference.html#//apple_ref/c/econst/kAudioSessionProperty_AudioRoute

for kAudioSessionProperty_OverrideAudioRoute:

"This property can be used only with the kAudioSessionCategory_PlayAndRecord (or the equivalent AVAudioSessionCategoryRecord) category."

If you have it se to any other Audio Session category it will not work