Skip to content

Commit ffe26d8

Browse files
committed
Fix loading StreamInfo twice on first VideoDetailFragment opening
1 parent 83f8141 commit ffe26d8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,12 @@ public static void openVideoDetailFragment(@NonNull final Context context,
452452
if (fragment instanceof VideoDetailFragment && fragment.isVisible()) {
453453
onVideoDetailFragmentReady.run((VideoDetailFragment) fragment);
454454
} else {
455+
// Specify no videoUrl here, otherwise the VideoDetailFragment will start loading the
456+
// video automatically if it's the first time it is being opened, but then
457+
// onVideoDetailFragmentReady will kick in and start another loading process.
458+
// See VideoDetailFragment.wasCleared() and its usage in doInitialLoadLogic().
455459
final VideoDetailFragment instance = VideoDetailFragment
456-
.getInstance(serviceId, url, title, playQueue);
460+
.getInstance(serviceId, null, title, playQueue);
457461
instance.setAutoPlay(autoPlay);
458462

459463
defaultTransaction(fragmentManager)

0 commit comments

Comments
 (0)