• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: My Iphone audio player app gets interrupted by the iPod
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My Iphone audio player app gets interrupted by the iPod


  • Subject: Re: My Iphone audio player app gets interrupted by the iPod
  • From: "Roni Music" <email@hidden>
  • Date: Wed, 14 Oct 2009 19:22:59 +0200



Thanks for the fast reply!


There are 3 interlocking issues here.

1. You really want to get those play/pause commands from the headphones cable.
Currently there is no way to do that. I cannot comment on the content of future releases,
but you might imagine that this is causing pain internally (we are all iPhone users, too).
This happens to me when listening to podcasts in Safari: I hit the play/pause button on the headphones cable,
and iPod app starts up and interrupts Safari. <bleah>

OK, then we hope for something in a future update of the OS ;-)


2. You should be getting an interruption callback "end interruption" when iPod app stops.
I'm surprised you aren't... what iPhone OS version are you running on?

I just updated to OS 3.1.2 and I can confirm that my app never receives the kAudioSessionEndInterruption
when one pauses the iPod player again.



We fixed this a while ago (in 3.0, I think, or maybe as late as 3.1).

3. When the user touches your apps play button, you fail to play because you are not active.
This you can fix! If the user presses the play button in your app, calling AudioSessionSetActive(true) before
starting playback is a perfectly reasonable thing to do. It's OK to interrupt other apps' audio if the user asks you to,
<even if you haven't received an "end interruption" callback. Even without the bug in (2) above, iPod app might still
be playing when the user hits the play button, so you legitimately might not have received the "end interruption" callback.

OK, that was an easy fix, works fine.
So one can call AudioSessionSetActive(true) before every playback call even though it's already active?


Also, after a kAudioSessionEndInterruption, I also set the kAudioSessionCategory_xx plus AudioSessionSetActive(true)
I think I do that after reading some docs long ago, is this needed?
It doesn't seem so since after the iPod interrupted my app, only calling AudioSessionSetActive(true) makes it play OK again.


Rolf



Greg


On Oct 14, 2009, at 7:58 AM, Roni Music wrote:


My iPhone audio player uses the kAudioSessionCategory_MediaPlayback category.


When it's playing and a user presses the "play/pause button" on the headphones cable,
my interruption listener callback gets called with a kAudioSessionBeginInterruption event,
my player stops and the iPod player starts playing in the background.


The user that presses the "play/pause button" on the headphones cable does this with the intention to play/pause my app and
NOT the iPod player. He then presses the "play/pause button" on the headphones cable again to stop the iPod player
but my application is never informed by the interruption listener callback about this and thus never calls AudioSessionSetActive(true)
and it fails to start when the user presses the regular screen play button.


So, when my app is running, how can I prevent the iPod player to start playing in the background
or even better,
is there a way to trap the presses on the headphones cables and in that way control my player?


Thanks for any help,
Rolf Nilsson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/coreaudio-api/attachments/20091014/1fa5d22b/attachment.html


------------------------------

_______________________________________________
Coreaudio-api mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/coreaudio-api

End of Coreaudio-api Digest, Vol 6, Issue 391
*********************************************


_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: My Iphone audio player app gets interrupted by the iPod
      • From: Greg Chapman <email@hidden>
  • Prev by Date: Re: Recommended way to handle suspend/resume on notebooks
  • Next by Date: Re: My Iphone audio player app gets interrupted by the iPod
  • Previous by thread: Re: My Iphone audio player app gets interrupted by the iPod player - how to prevent that?
  • Next by thread: Re: My Iphone audio player app gets interrupted by the iPod
  • Index(es):
    • Date
    • Thread