mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
More gracefully recover from streaming playback errors in
ExoPlayerWrapper.
This commit is contained in:
parent
ba62116a16
commit
24bf49408d
@ -163,9 +163,18 @@ public class ExoPlayerWrapper extends PlayerWrapper {
|
||||
public void resume() {
|
||||
Preconditions.throwIfNotOnMainThread();
|
||||
|
||||
if (this.getState() == State.Paused || this.getState() == State.Prepared) {
|
||||
this.player.setPlayWhenReady(true);
|
||||
setState(State.Playing);
|
||||
switch (this.getState()) {
|
||||
case Paused:
|
||||
case Prepared:
|
||||
this.player.setPlayWhenReady(true);
|
||||
setState(State.Playing);
|
||||
break;
|
||||
|
||||
case Error:
|
||||
this.player.setPlayWhenReady(true);
|
||||
this.player.prepare(this.source);
|
||||
setState(State.Preparing);
|
||||
break;
|
||||
}
|
||||
|
||||
this.prefetch = false;
|
||||
@ -294,6 +303,10 @@ public class ExoPlayerWrapper extends PlayerWrapper {
|
||||
dispose();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
player.setPlayWhenReady(false);
|
||||
setPosition(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +316,6 @@ public class ExoPlayerWrapper extends PlayerWrapper {
|
||||
case Playing:
|
||||
case Paused:
|
||||
setState(State.Error);
|
||||
dispose();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
android:id="@+id/fast_scroller"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
app:rfs_touchTargetWidth="32dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user