2

I have an iOS app made with Pphonegap 1.8.1 and Sencha Touch 2 that plays HTML5 audio. I've set UIBackgroundModes -> audio in my info.plist and followed this answer to allow background audio on iOS6.

My issue is that whenever I play audio in the background, it will persist and overlap with previously played tracks. To reproduce:

  1. Play HTML5 audio inside an app on an iOS 6 device.
  2. Toggle the display off and on, so that you are on the lock screen (audio continues to play as expected).
  3. Unlock and return to the app.
  4. Stop the HTML5 audio and play another track.
  5. Toggle the display off and on, so that you are on the lock screen (audio continues to play as expected).
  6. Double tap the home button to display the audio controls on the lock screen, and tap the pause button.

Result:
The currently playing audio is paused but the previous audio (from step 1) now starts to play. If you tap the next track button, then the previous track, and then tap play, it will play both audio items at the same time.

Note:
On iOS 5.1, previously played background audio is not persisted.

Is there a way I can ensure only the last played audio from the app is available in the background on iOS 6?

Community
  • 1
  • 1
  • Unfortunately I do not have a solution. But a similar scenario is in pure HTML5 browser. If you have 2 browser tabs on an Iphone 4 each with a paused audio element. The built in play button will start both audio elements play simultaneous. You have to kill all other active audio elements somehow when instantiating a new one. – Baxter Dec 14 '12 at 15:43

0 Answers0