1

Is it possible to mix my app's audio with the music player audio?

I find that by default, android does mix the audio of the music player with my app. However this stops working after calling AudioManager.requestAudioFocus method. Meaning, if the music player is playing, when my app starts playing, it stops the music player. I want them to play at the same time.

I request the audio focus so I can know when other interruptions such as phone calls have happened. I do want to stop my app's audio when a phone call happens.

My audio plays sin waves, it is a medical device. I request the audio focus with AudioManager.STREAM_MUSIC and AudioManager.AUDIOFOCUS_GAIN. I am using AudioTrack to play them.

mikemeli
  • 725
  • 11
  • 24
  • Since I could not find a solution, I decided not to use the audio focus manager. Instead, I just register for phone call notifications, as explained in this post http://stackoverflow.com/questions/5610464/stopping-starting-music-on-incoming-calls. – mikemeli Sep 19 '12 at 21:57
  • Just a thought: would audio with ducking have been appropriate? See http://developer.android.com/training/managing-audio/audio-focus.html – dragonridingsorceress Jan 23 '13 at 02:56

0 Answers0