Do not skip track on error if the user paused playback. Fixed an issue where two track could be marked as playing at the same time in TracksFragment.

This commit is contained in:
Antoine POPINEAU 2020-06-26 19:05:11 +02:00
parent 212b44a22f
commit 9b888ba17f
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
2 changed files with 10 additions and 6 deletions

View File

@ -181,7 +181,10 @@ class TracksFragment : FunkwhaleFragment<Track, TracksAdapter>() {
private fun refreshCurrentTrack(track: Track?) {
track?.let {
adapter.currentTrack = track
adapter.currentTrack?.current = false
adapter.currentTrack = track.apply {
current = true
}
adapter.notifyDataSetChanged()
}
}

View File

@ -394,12 +394,13 @@ class PlayerService : Service() {
override fun onPlayerError(error: ExoPlaybackException) {
EventBus.send(Event.PlaybackError(getString(R.string.error_playback)))
queue.current++
player.prepare(queue.datasources, true, true)
player.seekTo(queue.current, 0)
player.playWhenReady = true
if (player.playWhenReady) {
queue.current++
player.prepare(queue.datasources, true, true)
player.seekTo(queue.current, 0)
CommandBus.send(Command.RefreshTrack(queue.current()))
CommandBus.send(Command.RefreshTrack(queue.current()))
}
}
}