I am having a bunch of songs of which I am making a ConcatenatingMediaSource
...
allSongs.forEach {
concatenatingMediaSource.addMediaSource(makeMediaSource(it.source))
}
...
MakeMediaSource function
private fun makeMediaSource(sourceOfSong: String): ProgressiveMediaSource {
val dataSourceFactory = DefaultDataSourceFactory(
this,
getUserAgent(this, "ApplicationName")
)
return ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(
Uri.parse(sourceOfSong)
)
}
I wanted to play a random song from the playlist so when I used seekTo(windowIndex, playbackPosition) then the app crashed. Then, on doing Log.d of player.nextWindowIndex and player.previousWindowIndex I got -1 then I checked timeline through player.currentTimeline.isEmpty then I got true. But concatenatingMediaSource.size is giving the correct number of songs that I have added. I don't understand why is it happening?
from Empty Timeline despite adding ConcatenatingMediaSouce in ExoPlayer
No comments:
Post a Comment