I am building an audio player where user can select a song which he wants to listen from a ListView. After he clicks on a song, audio player starts playing that song.
Audio files are not stored locally, they are fetched from some online audio library. After user opens a list of songs, he receives a lot of urls who look like this:
http://ift.tt/1xCwair
http://ift.tt/1D6rE2f
http://ift.tt/1xCwaiw
Each song is identified with unique id as you can see. It's easy to temp download that song and play audio and that is working fine. The thing I want to accomplish is something like this:
- User clicks on a song1 in list view and song1 starts playing
- In the middle of the reproduction, user decides he had enough of song1 and switches to song2
- He closes the app while song2 is still not finished
- Next time when he opens an app, if he clicks on song1 or song2, reproduction starts from the place where he stopped listening for the song1 or song2
How to efficiently accomplish something like that on Android? Should I create an SQLite database for this situation, use SharedPreferences or something else? How do you usually handle similar situations?
Thank you :)
Aucun commentaire:
Enregistrer un commentaire