File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
app/src/main/java/io/compactd/player/service Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ public class MediaPlayerService extends Service implements MediaPlayer.OnComplet
8888 private int resumePosition ;
8989 private AudioManager audioManager ;
9090 private Handler handler = new Handler ();
91- private boolean playerReady ;
91+ private boolean playerReady = false ;
9292 private boolean shuffling ;
9393
9494 public boolean isPlaying () {
@@ -654,8 +654,11 @@ private void updatePlaylist() {
654654 }
655655
656656 firePrepareMedia (track );
657+
657658 player .setOnCompletionListener (null );
659+ playerReady = false ;
658660 player .reset ();
661+
659662 setDataSource (track );
660663 player .prepareAsync ();
661664
@@ -840,7 +843,10 @@ private boolean removeAudioFocus () {
840843
841844
842845 public int getProgress () {
843- return player .getCurrentPosition ();
846+ if (playerReady ) {
847+ return player .getCurrentPosition ();
848+ }
849+ return 0 ;
844850 }
845851
846852 public int getDuration () {
You can’t perform that action at this time.
0 commit comments