Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone audio playback: force through internal speaker?

Tags:

iphone

audio

Does anyone know if it is possible to implement playback of an audio file through the internal speaker even if the headphones are plugged in?

like image 972
Cruinh Avatar asked Jun 30 '09 17:06

Cruinh


People also ask

How do I change the default audio source on my iPhone?

We understand you're looking to change the default audio output source for phone calls on your iPhone. There is a settings in Settings > Accessibility > Touch > Call Audio Routing where you can set it to Automatic, Bluetooth Headset or Speaker. Give that a try. Thanks.

How do I fix the audio glitch on my iPhone?

Go to Settings > Sounds (or Settings > Sounds & Haptics), and drag the Ringer and Alerts slider back and forth a few times. If you can't hear any sound, or if your speaker button on the Ringer and Alerts slider is dimmed, your speaker may need to be serviced.


1 Answers

I'm not sure how you are doing your audio playback, but try having a look at the "Redirecting Output Audio" section of the Audio Session Programming Guide

It looks something like this:

UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;  // 1 
AudioSessionSetProperty ( 
    kAudioSessionProperty_OverrideAudioRoute,                         // 2 
    sizeof (audioRouteOverride),                                      // 3 
    &audioRouteOverride                                               // 4 
); 
like image 180
slf Avatar answered Oct 21 '22 17:10

slf