Final media player for android9/26/2023 ![]() ![]() This can be achieved using a background service rather than playing the music in the app’s activity. Another thing that we want our media player to do is allow the user to work on other things while the media is playing in the background. We will therefore use prepareAsync() method which prepares the media player in background on another thread and notifies the onPreparedListener when the prepare method is complete. While the audio is preparing, the android’s UI might seem to be non-functional and wouldn’t respond to user requests. Preapre method prepares the audio for playback and can therefore take a long time. prepare ( ) // might take long! (for buffering, etc) String url = "URL" // your URL here MediaPlayer mediaPlayer = new MediaPlayer ( )
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |