On 12/09/2021 I posted the following question located here: How do I keep music playing on external player?
Question was: I have developed an app to time my exercise. When I play an internal sound "one minute" to notify my exercise period has one minute to go it causes my external (default) music player to pause. I want to find a way to prevent the player from pausing.
The result of this discussion is to know that Android music players have an event within them whereby you can automatically pause your player in order to allow another one to play should someone do this. THANK YOU Taifun for pointing this out to me.
In my case I wanted only to play my sound (short) while music continues to play without the music being interrupted. To my dismay there are no music players that I can find that will allow this. They ALL pause as soon as another sound is played.
SOLUTION:
MIT AI has a "Player" object and it also has a "Sound" object. Cell phones (as well as PCs) have multiple sound channels. You may have noticed this when you attempt to adjust volume and suddenly there are several volumes that come up. Music, Alarm, Bell, Notify and others will appear. Just when you think you understand them all, your earphone volume will spring up!
I have read many articles here and on the internet and YouTube. I have not seen any that distinguish between "Player" and "Sound". In this tutorial I wish to show this difference since it is possible to play both at the same time. I have not seen any blocks of how to use "Sound" and more importantly how to use "Sound" to play multiple sounds like you can with the music "Player".
Here I use the "Sound" object and play from a list in a similar way that you would use "Player" object. The most important part of my ability to perform this "Sound Player" is to be able to know when the sound has stopped playing. To be able to do so I used Taifun's Player extension which is found here: https://puravidaapps.com/player.php
In his extension he has a method called “TaifunPlayer.Duration” which will measure, in milliseconds, the length of a sound file. I start playing the sound just long enough to measure its size and set a timer that will end as soon as the sound is over, which allows me to calculate when to begin playing the next sound.
A HUGE THANK YOU to Taifun for his many contributions to the MIT AI community.