From ffe26d882b6cfdd8405060061f7358e10ac528f6 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sun, 26 Jan 2025 12:39:07 +0100 Subject: [PATCH 1/2] 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) From 01bf855015a7ae3f5ec879b4051cb24fc3e85fb5 Mon Sep 17 00:00:00 2001 From: Stypox Date: Mon, 27 Jan 2025 14:52:35 +0100 Subject: [PATCH 2/2] Fix naming in VideoDetailFragment: video->stream, videoUrl->url --- .../newpipe/fragments/detail/VideoDetailFragment.java | 6 +++--- .../main/java/org/schabi/newpipe/util/NavigationHelper.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 1d1e166e7..40a22103b 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -283,11 +283,11 @@ public final class VideoDetailFragment /*////////////////////////////////////////////////////////////////////////*/ public static VideoDetailFragment getInstance(final int serviceId, - @Nullable final String videoUrl, + @Nullable final String url, @NonNull final String name, @Nullable final PlayQueue queue) { final VideoDetailFragment instance = new VideoDetailFragment(); - instance.setInitialData(serviceId, videoUrl, name, queue); + instance.setInitialData(serviceId, url, name, queue); return instance; } @@ -1736,7 +1736,7 @@ public final class VideoDetailFragment playQueue = queue; if (DEBUG) { Log.d(TAG, "onQueueUpdate() called with: serviceId = [" - + serviceId + "], videoUrl = [" + url + "], name = [" + + serviceId + "], url = [" + url + "], name = [" + title + "], playQueue = [" + playQueue + "]"); } 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 4a9ddac6b..e4cb46f94 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,8 @@ 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 + // Specify no url here, otherwise the VideoDetailFragment will start loading the + // stream 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