Skip to content

Commit eb277fe

Browse files
committed
Player/handleIntent: call handleIntentPost unconditionally
We always need to handleIntentPost otherwise the VideoDetailFragment is not setup correctly.
1 parent d77771a commit eb277fe

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ public void handleIntent(@NonNull final Intent intent) {
375375
}
376376
}
377377

378-
final PlayerType oldPlayerType = playerType;
379378
playerType = newPlayerType;
380379
initUIsForCurrentPlayerType();
381380
isAudioOnly = audioPlayerSelected();
@@ -459,8 +458,6 @@ public void handleIntent(@NonNull final Intent intent) {
459458
initPlayback(newPlayQueue, playWhenReady);
460459
}
461460

462-
handleIntentPost(oldPlayerType);
463-
464461
}, throwable -> {
465462
// This will only show a snackbar if the passed context has a root view:
466463
// otherwise it will resort to showing a notification, so we are safe
@@ -560,11 +557,10 @@ public void handleIntent(@NonNull final Intent intent) {
560557
initPlayback(samePlayQueue ? playQueue : newQueue, playWhenReady);
561558
}
562559

563-
handleIntentPost(oldPlayerType);
564560
}
565561

566562

567-
private void handleIntentPost(final PlayerType oldPlayerType) {
563+
public void handleIntentPost(final PlayerType oldPlayerType) {
568564
if (oldPlayerType != playerType && playQueue != null) {
569565
// If playerType changes from one to another we should reload the player
570566
// (to disable/enable video stream or to set quality)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ public int onStartCommand(final Intent intent, final int flags, final int startI
169169
}
170170

171171
if (player != null) {
172+
final PlayerType oldPlayerType = player.getPlayerType();
172173
player.handleIntent(intent);
174+
player.handleIntentPost(oldPlayerType);
173175
player.UIs().get(MediaSessionPlayerUi.class)
174176
.ifPresent(ui -> ui.handleMediaButtonIntent(intent));
175177
}

0 commit comments

Comments
 (0)