Skip to content

Commit c272309

Browse files
committed
Avoid rebuilding BackgroundPlayerUi if already in place
1 parent 216867c commit c272309

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ private static PlayQueue getPlayQueueFromCache(@NonNull final Intent intent) {
576576

577577
private void initUIsForCurrentPlayerType() {
578578
if ((UIs.get(MainPlayerUi.class).isPresent() && playerType == PlayerType.MAIN)
579+
|| (UIs.get(BackgroundPlayerUi.class).isPresent() && playerType == PlayerType.AUDIO)
579580
|| (UIs.get(PopupPlayerUi.class).isPresent() && playerType == PlayerType.POPUP)) {
580581
// correct UI already in place
581582
return;
@@ -603,7 +604,7 @@ private void initUIsForCurrentPlayerType() {
603604
UIs.addAndPrepare(new PopupPlayerUi(this, binding));
604605
break;
605606
case AUDIO:
606-
UIs.destroyAll(VideoPlayerUi.class);
607+
UIs.destroyAll(VideoPlayerUi.class); // destroys both MainPlayerUi and PopupPlayerUi
607608
UIs.addAndPrepare(new BackgroundPlayerUi(this));
608609
break;
609610
}

0 commit comments

Comments
 (0)