How can I play background audio, in Android, without interrupting the MediaPlayer
playback, by either using MediaPlayer
(preferred) or OpenSL ES?
I know SoundPool
is able to play sound effects without interrupting any MediaPlayer
playback, but the size is limited to 1M per effect, which is way to less. Not requesting audio focus, via AudioManager
doesn't seem to work either, audio doesn't play at all in this case.
And in the case of OpenSL ES, all audio generally stops when I start to play a longer asset file. It's similar to the behaviour of SoundPool
described above.
Edit from the comments:
I don't want to interrupt other music players, it's the background audio of a game, which shall play without interrupting the, for example, music of a player. Games like Subway Surfer, Clash Royale and such seem to have this achieved somehow, but I could not achieve it via OpenSL ES, or MediaPlayer.