Skip to content

Commit

Permalink
Fix demo app to avoid seeking if resume position is clear
Browse files Browse the repository at this point in the history
This fixed the resume live window issue by modifying the demo app.

Issue:#2344

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145987470
  • Loading branch information
AquilesCanta authored and ojw28 committed Jan 30, 2017
1 parent 9a90795 commit 7ee8567
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,11 @@ private void initializePlayer() {
}
MediaSource mediaSource = mediaSources.length == 1 ? mediaSources[0]
: new ConcatenatingMediaSource(mediaSources);
player.seekTo(resumeWindow, resumePosition);
player.prepare(mediaSource, false, false);
boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
if (haveResumePosition) {
player.seekTo(resumeWindow, resumePosition);
}
player.prepare(mediaSource, !haveResumePosition, !haveResumePosition);
playerNeedsSource = false;
updateButtonVisibilities();
}
Expand Down Expand Up @@ -377,7 +380,7 @@ private void updateResumePosition() {
}

private void clearResumePosition() {
resumeWindow = 0;
resumeWindow = C.INDEX_UNSET;
resumePosition = C.TIME_UNSET;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ public void prepare(MediaSource mediaSource) {
}

@Override
public void prepare(MediaSource mediaSource, boolean resetPosition, boolean resetTimeline) {
player.prepare(mediaSource, resetPosition, resetTimeline);
public void prepare(MediaSource mediaSource, boolean resetPosition, boolean resetState) {
player.prepare(mediaSource, resetPosition, resetState);
}

@Override
Expand Down

0 comments on commit 7ee8567

Please sign in to comment.