Skip to content

Commit

Permalink
workaround for initial seek with new exoplayer not working
Browse files Browse the repository at this point in the history
  • Loading branch information
theScrabi committed Mar 10, 2021
1 parent 2247628 commit 5a09a3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ private void preparePlayer() {
player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, new DefaultLoadControl());
player.addListener(this);
exoPlayerView.setPlayer(player);
player.seekTo(mPlaybackPosition);
player.setPlayWhenReady(mAutoplay);

(new Handler()).postDelayed(() -> {
player.seekTo(mPlaybackPosition);
player.setPlayWhenReady(mAutoplay);
}, 1000);
// Prepare video player asynchronously
new PrepareVideoPlayerAsyncTask(getApplicationContext(), this, getFile(), getAccount(),
mainHandler).execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,12 @@ public void onResume() {

preparePlayer();

if (player != null) {
player.seekTo(mPlaybackPosition);
player.setPlayWhenReady(mAutoplay);
}
(new Handler()).postDelayed(() -> {
if (player != null) {
player.seekTo(mPlaybackPosition);
player.setPlayWhenReady(mAutoplay);
}
}, 1000);
}

@Override
Expand Down

0 comments on commit 5a09a3f

Please sign in to comment.