I am using an instance of MediaPlayer to stream audio files from an Internet location. The audio player is in separate mode. The user can select from the list of audio files and go to this operation to play sound.
Now the user can return to the previous action (with a list) and select a different audio file. In this case, I want to stop any other sound that is being played and start playing the new audio that has been selected.
Is there any way I can find out if an audio file is playing without holding the MediaPlayer object?
Thanks.
Edit
I learned how to find out if a sound is playing. We can do this by using the AudioManager object and calling isAudioPlaying (). This will return true if any sound is being played.
Now another question: how to stop sound playback now? I do not have an instance of the MediaPlayer object that was created to start the audio (since the user has already left the action once and returned with a new activity object and, therefore, a new instance of MediaPlayer)
android
lostInTransit
source share