From ffe26d882b6cfdd8405060061f7358e10ac528f6 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sun, 26 Jan 2025 12:39:07 +0100 Subject: [PATCH] Fix loading StreamInfo twice on first VideoDetailFragment opening --- .../main/java/org/schabi/newpipe/util/NavigationHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java index 5dee32371..4a9ddac6b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java @@ -452,8 +452,12 @@ public final class NavigationHelper { if (fragment instanceof VideoDetailFragment && fragment.isVisible()) { onVideoDetailFragmentReady.run((VideoDetailFragment) fragment); } else { + // Specify no videoUrl here, otherwise the VideoDetailFragment will start loading the + // video automatically if it's the first time it is being opened, but then + // onVideoDetailFragmentReady will kick in and start another loading process. + // See VideoDetailFragment.wasCleared() and its usage in doInitialLoadLogic(). final VideoDetailFragment instance = VideoDetailFragment - .getInstance(serviceId, url, title, playQueue); + .getInstance(serviceId, null, title, playQueue); instance.setAutoPlay(autoPlay); defaultTransaction(fragmentManager)