Hello all,

I’ve been working with the iOS SDK for about a month and I’m having trouble figuring something out. I have been developing using an iPhone 5S and I’m having a strange issue with it. By default, all audio is played through the earpiece of the phone rather than the built in speaker. As a result everything is very quiet, and what you can hear sounds awful. However, if I plug in headphones they are detected and used automatically. I have also tried my game on iPads and that works just fine. The built in speaker is used.

I’m just wondering if this is a bug, or if that is the expected behavior and I’m just missing something. If that’s the case how do I switch to the builtin speaker from the earpiece? Btw, I’m running iOS 8.4 on my iPhone.

Thank you,

~ Kirk

  • You must to post comments
Best Answer

For FMOD4:

Audio output will switch to the earpiece when you use FMOD_IPHONE_SESSIONCATEGORY_PLAYANDRECORD.

This is because the OS is trying to prevent feedback from the microphone to the speakers.
You can override this via FMOD_IPHONE_EXTRADRIVERDATA::forceSpeakerOutput.

Also, if you call System::recordStart, FMOD will automatically switch to ‘PlayAndRecord’ as required by the OS.

For FMOD5:

FMOD5 no longer handles audio sessions, this must be set up as necessary by the developer. See the Apple SDK docs for more information about the API to use. If you aren’t using the record APIs I suggest AVAudioSessionCategorySoloAmbient. If you are then you must use AVAudioSessionCategoryPlayAndRecord, you can correct the earpiece issue with AVAudioSessionPortOverrideSpeaker.

    Hey Mathew, So I might have posted this question in the wrong place. I think I might actually be working with FMOD 5, not 4... I apologize. In any case, how does this effect the answer you have provided? Thanks, and again my apologies.
  • Mathew Block
    I've added FMOD 5 related information to my answer.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.