Reputation: 1684
I have created a SimpleExoPlayer with mediaItems as below
// convert each model to MediaItems
fun ExoPlayerModel.toMediaItem(): MediaItem =
MediaItem.fromUri(this.songUrl.toUri())
// In Service Class
val simpleExoPlayer = SimpleExoPlayer.Builder(this).build()
// some codes
for (model in exoPlayerModelList) {
simpleExoPlayer.addMediaItem(model.toMediaItem())
}
simpleExoPlayer.prepare()
It works fine. I want to get each MediaItems duration so I will able to show it on UI.
Upvotes: 1
Views: 375