Browse Source

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.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
9b888ba17f
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 5
      app/src/main/java/com/github/apognu/otter/fragments/TracksFragment.kt
  2. 11
      app/src/main/java/com/github/apognu/otter/playback/PlayerService.kt

5
app/src/main/java/com/github/apognu/otter/fragments/TracksFragment.kt

@ -181,7 +181,10 @@ class TracksFragment : FunkwhaleFragment<Track, TracksAdapter>() { @@ -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()
}
}

11
app/src/main/java/com/github/apognu/otter/playback/PlayerService.kt

@ -394,12 +394,13 @@ class PlayerService : Service() { @@ -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()))
}
}
}

Loading…
Cancel
Save