Skip to content

Commit

Permalink
Merge pull request #11959 from Stypox/fix-loading-stream-twice
Browse files Browse the repository at this point in the history
Fix loading StreamInfo twice on first VideoDetailFragment opening
  • Loading branch information
Stypox authored Jan 27, 2025
2 parents ebf3008 + 01bf855 commit 47263f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ public void onServiceDisconnected() {
/*////////////////////////////////////////////////////////////////////////*/

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;
}

Expand Down Expand Up @@ -1736,7 +1736,7 @@ public void onQueueUpdate(final PlayQueue queue) {
playQueue = queue;
if (DEBUG) {
Log.d(TAG, "onQueueUpdate() called with: serviceId = ["
+ serviceId + "], videoUrl = [" + url + "], name = ["
+ serviceId + "], url = [" + url + "], name = ["
+ title + "], playQueue = [" + playQueue + "]");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,12 @@ public static void openVideoDetailFragment(@NonNull final Context context,
if (fragment instanceof VideoDetailFragment && fragment.isVisible()) {
onVideoDetailFragmentReady.run((VideoDetailFragment) fragment);
} else {
// 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
.getInstance(serviceId, url, title, playQueue);
.getInstance(serviceId, null, title, playQueue);
instance.setAutoPlay(autoPlay);

defaultTransaction(fragmentManager)
Expand Down

0 comments on commit 47263f5

Please sign in to comment.