0

I'm building an app in PhoneGap Build and wondered if it was possible to cut a tone into music already playing in the background? For example if i'm listening to spotify and a tone in my app is played to signify an achievement, it will fade the spotify, play the app tone and then carry on playing spotify.

So far it fades into the spotify music nicely, but pauses spotify.

Thanks

jord49
  • 542
  • 2
  • 17
  • 37

1 Answers1

0

This may not be directly achievable using Cordova's current implementation. What you want to do is to have your soundplayer run as a service, which will be independent from the main activities.

Similar questions have been asked in the past for native Android implementations:

  1. Play background music in all activities of Android app
  2. Android background music service
  3. http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-ii

If I were to do it on Cordova now, I would start hacking the Media plugin.

Community
  • 1
  • 1
James Wong
  • 4,529
  • 4
  • 48
  • 65