Avoid rebuilding BackgroundPlayerUi if already in place

This commit is contained in:
Stypox 2026-01-28 02:39:56 +01:00
parent 216867c597
commit c2723096ab
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -576,6 +576,7 @@ public final class Player implements PlaybackListener, Listener {
private void initUIsForCurrentPlayerType() {
if ((UIs.get(MainPlayerUi.class).isPresent() && playerType == PlayerType.MAIN)
|| (UIs.get(BackgroundPlayerUi.class).isPresent() && playerType == PlayerType.AUDIO)
|| (UIs.get(PopupPlayerUi.class).isPresent() && playerType == PlayerType.POPUP)) {
// correct UI already in place
return;
@ -603,7 +604,7 @@ public final class Player implements PlaybackListener, Listener {
UIs.addAndPrepare(new PopupPlayerUi(this, binding));
break;
case AUDIO:
UIs.destroyAll(VideoPlayerUi.class);
UIs.destroyAll(VideoPlayerUi.class); // destroys both MainPlayerUi and PopupPlayerUi
UIs.addAndPrepare(new BackgroundPlayerUi(this));
break;
}