tags:

views:

153

answers:

1

Hello,

How can we play audio using the ear speaker from an application. The audio plays like some one is talking at the other end of the phone.

Thanks

+1  A: 

It sounds like what you're looking for is this: (from Apple's documentation)

Audio Session Category Route Overrides

Specifies whether the default audio route for the PlayAndRecord category should be overridden.

enum {
   kAudioSessionOverrideAudioRoute_None    = 0,
   kAudioSessionOverrideAudioRoute_Speaker = 'spkr'
};

Constants

kAudioSessionOverrideAudioRoute_None

Specifies, for the kAudioSessionCategory_PlayAndRecord category, that output audio should go to the receiver. This is the default output audio route for this category.

kAudioSessionOverrideAudioRoute_Speaker

Specifies, for the kAudioSessionCategory_PlayAndRecord category, that output audio should go to the speaker, not the receiver.

Discussion The kAudioSessionCategory_PlayAndRecord category supports simultaneous input and output. You could use this category, for example, to add an effect to audio coming into the iPhone’s microphone. By default, output audio for this category goes to the receiver—the speaker you hold to your ear when on a phone call. The kAudioSessionOverrideAudioRoute_Speaker constant lets you direct the output audio to the speaker situated at the bottom of the phone.

Timothée Boucher