Commit e62da368 by tonihei Committed by Andrew Lewis

Use player.retry in demo app instead of manual position tracking.

We currently do manual position tracking while the player is in error mode.
This is to allow an initial seek to the new position when trying to re-prepare.

Instead, we can just use our player.retry method and remove the tracking code.

PiperOrigin-RevId: 243819580
parent 8e7a2ba9
......@@ -311,7 +311,7 @@ public class PlayerActivity extends AppCompatActivity
@Override
public void preparePlayback() {
initializePlayer();
player.retry();
}
// PlaybackControlView.VisibilityListener implementation
......@@ -642,21 +642,11 @@ public class PlayerActivity extends AppCompatActivity
}
@Override
public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason) {
if (player.getPlaybackError() != null) {
// The user has performed a seek whilst in the error state. Update the resume position so
// that if the user then retries, playback resumes from the position to which they seeked.
updateStartPosition();
}
}
@Override
public void onPlayerError(ExoPlaybackException e) {
if (isBehindLiveWindow(e)) {
clearStartPosition();
initializePlayer();
} else {
updateStartPosition();
updateButtonVisibility();
showControls();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment