Newy
Newy

Reputation: 40107

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

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
                                 );

Upvotes: 2

Views: 956

Answers (1)

ambertch
ambertch

Reputation: 7649

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

Upvotes: 1

Related Questions