Skip to content

Commit

Permalink
fix: show progress bar while buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
MrIkso committed Dec 28, 2024
1 parent 1087266 commit 3af7b9e
Showing 1 changed file with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ private void preparePlayer(boolean restorePlayer) {
playerView.setControllerHideOnTouch(true);
playerView.setControllerAutoShow(true);
playerView.setUseController(true);
// playerView.setUseArtwork(true);
//playerView.setShowBuffering(PlayerView.SHOW_BUFFERING_NEVER);
/// playerView.setControllerShowTimeoutMs(-1);

var doubleTapView = ((DoubleTapPlayerView) playerView);
Expand Down Expand Up @@ -341,7 +343,10 @@ private void preparePlayer(boolean restorePlayer) {
// exoPlayer.setPlayWhenReady(playWhenReady);
exoPlayer.prepare();

// if (autoContinue) {
playVideo();
// }

if (Utils.isPiPSupported(this)) {
setPictureInPictureParams(getPipParams(exoPlayer.isPlaying()));
}
Expand Down Expand Up @@ -830,6 +835,28 @@ private void showContinuePlayDialog(EpisodeModel episode) {
}
}

private void showProgressBarAndControlToggle(boolean isShow) {
if (isShow) {
playerView.showController();
exoProgressBar.setVisibility(View.VISIBLE);
exoPlay.setVisibility(View.GONE);
exoNextEp.setVisibility(View.INVISIBLE);
exoPrevEp.setVisibility(View.INVISIBLE);
exoTopControllers.setVisibility(View.INVISIBLE);
exoBottomControllers.setVisibility(View.INVISIBLE);
exoLock.setVisibility(View.INVISIBLE);
} else {
playerView.hideController();
exoProgressBar.setVisibility(View.GONE);
exoPlay.setVisibility(View.VISIBLE);
exoNextEp.setVisibility(View.VISIBLE);
exoPrevEp.setVisibility(View.VISIBLE);
exoTopControllers.setVisibility(View.VISIBLE);
exoBottomControllers.setVisibility(View.VISIBLE);
exoLock.setVisibility(View.VISIBLE);
}
}

private void parseExtra() {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
Expand Down Expand Up @@ -983,16 +1010,11 @@ public void onPlaybackStateChanged(int playbackState) {

switch (playbackState) {
case Player.STATE_BUFFERING:
exoProgressBar.setVisibility(View.VISIBLE);
exoPlay.setVisibility(View.GONE);
case Player.STATE_IDLE:
showProgressBarAndControlToggle(true);
break;
case Player.STATE_READY:
exoProgressBar.setVisibility(View.GONE);
exoPlay.setVisibility(View.VISIBLE);
break;
case Player.STATE_IDLE:
exoProgressBar.setVisibility(View.VISIBLE);
exoPlay.setVisibility(View.GONE);
showProgressBarAndControlToggle(false);
break;
case Player.STATE_ENDED:
if (autoPlayNextEpisode) {
Expand Down

0 comments on commit 3af7b9e

Please sign in to comment.