Music fails to resume after being ducked for a few minutes

Reply
Highlighted

Music fails to resume after being ducked for a few minutes

Ninjars
Newbie

I'm a developer on Zombies, Run!, a health and fitness app that allows music to play in an external app, which we periodically interrupt with game audio. For a while now people have been reporting issues with Spotify's handling of audio interrupts to us, so I thought I'd mention them to you to see if it's something you can fix.

 

Zombies, Run! uses the AudioFocus api to duck using a call to 

AudioManager.requestAudioFocus(OnAudioFocusChangeListener, AudioManager.STREAM_MUSIC, focusDurationHint);

 

where focus duration hint may be 

AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK

 

or

AudioManager.AUDIOFOCUS_GAIN_TRANSIENT

 

Spotify correctly yields audio focus, and if the interruption is short enough will resume after Zombies, Run! audio plays. However, if the clip is longer than, say, a couple of minutes (I don't think we have any that get longer than four minutes), Spotify will not resume. The service remains alive, and play can be resumed manually, but the automatic resume fails.

 

As a point of compairson, Google Play Music doesn't have the same behaviour and is much more resilient at resuming after losing focus (though with a long enough suspension, say over five minutes or so even that may fail to resume).

 

I don't know if this is an issue with Android not guaranteeing to send audio focus updates after an arbitrary timeout, or down to Spotify's handling of transient audio focus changes - information either way would be helpful!

2 Replies

Re: Music fails to resume after being ducked for a few minutes

Daniel
Community Legend
Hi there,

This is a users community so I have no access to the way the Spotify app is written and what calls it makes. I have escalated this to staff so that hopefully one of the Android developers can have a look for you

Please use the search feature before posting a problem/bug/idea.
What's a Spotify Rock Star, and how do I become one?
     Using Spotify Since March 10th 2009
     Twitter: @mechanimal82

Android Troubleshooting:
[COMPLETE GUIDE] How to fix most Android issues
Spotify Android Version History

Re: Music fails to resume after being ducked for a few minutes

50percentgrey
Newbie

Thanks. I'm just a zombies run + spotify user but I actually had to stop using spotify on my runs because of this.

SUGGESTED POSTS