views:

34

answers:

1

Hi all,

I want to be notified if headphones are plugged in or plugged out. I'm currently doing this using a property listener like this:

AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange, myCallback, self);

This works perfectly well in all cases except in one, it goes like this:

  1. Launch, iPhone is unmuted, no headphones plugged in
  2. Switch the mute button on: The callback is called, good
  3. Plug in the headphones now: Callback is not called, not good

Is there another property I should consider? Is there a special case involving the mute button I'm not aware of?

I'm using an iPhone 3GS and iOS 4.1.

Thanks a lot for any help! Patrick

A: 

This bug/feature only happens when using an audio session category affected by the silent switch (e.g. kAudioSessionCategory_SoloAmbientSound). kAudioSessionCategory_MediaPlayback for example works as expected.