fix shuffle mode player getting stuck
This commit is contained in:
parent
0073277d6e
commit
991a98b571
1 changed files with 19 additions and 2 deletions
|
@ -21,6 +21,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
|
import com.google.android.exoplayer2.PlaybackParameters;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||||
import com.google.android.exoplayer2.audio.AudioAttributes;
|
import com.google.android.exoplayer2.audio.AudioAttributes;
|
||||||
|
@ -243,6 +244,23 @@ public class ShuffleFragment extends BaseFragment {
|
||||||
}
|
}
|
||||||
loadAndScheduleDurations();
|
loadAndScheduleDurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MainActivity.appPlayer != null) {
|
||||||
|
if (MainActivity.playerReassigned) {
|
||||||
|
setPlayerForPlayerView();
|
||||||
|
MainActivity.playerReassigned = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPlayerForPlayerView() {
|
||||||
|
View root = getView();
|
||||||
|
if (root != null) {
|
||||||
|
PlayerView view = root.findViewById(R.id.shuffle_exoplayer_view);
|
||||||
|
view.setVisibility(View.VISIBLE);
|
||||||
|
view.setPlayer(null);
|
||||||
|
view.setPlayer(MainActivity.appPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
@ -502,8 +520,7 @@ public class ShuffleFragment extends BaseFragment {
|
||||||
playbackStarted = false;
|
playbackStarted = false;
|
||||||
startTimeMillis = 0;
|
startTimeMillis = 0;
|
||||||
|
|
||||||
/*
|
/*if (MainActivity.appPlayer != null) {
|
||||||
if (MainActivity.appPlayer != null) {
|
|
||||||
MainActivity.appPlayer.stop(true);
|
MainActivity.appPlayer.stop(true);
|
||||||
MainActivity.appPlayer.removeListener(fileViewPlayerListener);
|
MainActivity.appPlayer.removeListener(fileViewPlayerListener);
|
||||||
PlaybackParameters params = new PlaybackParameters(1.0f);
|
PlaybackParameters params = new PlaybackParameters(1.0f);
|
||||||
|
|
Loading…
Reference in a new issue