Question

I'm using the kAudioSessionPoperty_AudioRoute and setting it to kAudioSessionOverrideAudioRouteSpeaker. I want the output audio to be routed through internal speakers only but when I insert headphones it gets routed through that.

Was it helpful?

Solution

Try this...

UInt32 sessionCategory = kAudioSessionCategory_PlayAndRecord;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);

UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top