In Android, there are some things called tasks and processes. Whenever an app is opened, processes are started, threads are created, and these run and together make a task. Android system is multi-tasking, no doubt on that, because you can switch from one app to another through the tabs option in your phone.
But, Android system runs only one main task. When you open an app, and you’re currently using it, then it becomes the main process at that point of time. Other apps, which may be open, continue to run in background, but only one app and its processes run in foreground.
Playing music, that is, accessing the speaker, can be done by foreground processes only. If you start a music to be played by some media player, and press the home button, then also the music keeps playing. You might think that the music is playing in background, but that is not the case. In this case, even if you’ve come to home screen, then also the app processes are running in foreground, although you’re not able to see the app window.
If you try to open any app at that moment, immediately the media player app processes become background, and hence the music is stopped.
In Android, threads and tasks cam be killed by pressing the back button.
Two main processes cannot work in foreground together. Many processes may run in background, but only one foreground main process.
In this context, you cannot play sound from two different apps together.