views:

1365

answers:

2

I'm recording audio with AVAudioRecorder as seen in http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder/1011273#1011273

I then use AVAudioPlayer to play back the recording. However the sound is coming out of the ear speaker, not the loud speaker. How would I go about redirecting the sound to the loud speaker ?

TIA!

A: 

Unplug your headphones.

Ian Terrell
no headphones are plugged in
dizy
+6  A: 

From http://www.iphonedevsdk.com/forum/iphone-sdk-development-advanced-discussion/12890-audiosessionsetproperty-problem-playing-sound-listening-mic.html --

UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);    
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);