0

I am developing an Android app in which the user can create a playlists of mp3 files. I am using Mediaplayer to control the playback of the mp3 files.

Which of the following is best to handle the playlist feature?

  1. Create multiple instances of a Mediaplayer, store them in an array and iterate the array and call prepareAsync() on each Mediaplayer object. Then iterate the array and start() each object and upon completion release() the object.

  2. Have one Mediaplayer instance and upon completion of the playback, reset() and change the dataSource of the object.

ChemDev
  • 827
  • 1
  • 8
  • 23

2 Answers2

1

As an answer, 2nd option looks fine to me, as there is no need to have multiple MediaPlayer instance instead its better to manage with single instance of MediaPlayer.

Currently, I am working on an application which plays list of videos one by one and for that I am using single VideoView and managing to play all the video just by resetting the datasource and that is working fine.

Lalit Poptani
  • 67,150
  • 23
  • 161
  • 242
0

You have to learn how to create a playlist and add songs (mp3 files) into a playlist. Here is one link on Stackoverflow, Android Create Playlist

If you still have questions, I may have better/other links on this matter. Good luck.

Community
  • 1
  • 1
The Original Android
  • 6,147
  • 3
  • 26
  • 31