mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Merge pull request #11959 from Stypox/fix-loading-stream-twice
Fix loading StreamInfo twice on first VideoDetailFragment opening
This commit is contained in:
		| @@ -283,11 +283,11 @@ public final class VideoDetailFragment | |||||||
|     /*////////////////////////////////////////////////////////////////////////*/ |     /*////////////////////////////////////////////////////////////////////////*/ | ||||||
|  |  | ||||||
|     public static VideoDetailFragment getInstance(final int serviceId, |     public static VideoDetailFragment getInstance(final int serviceId, | ||||||
|                                                   @Nullable final String videoUrl, |                                                   @Nullable final String url, | ||||||
|                                                   @NonNull final String name, |                                                   @NonNull final String name, | ||||||
|                                                   @Nullable final PlayQueue queue) { |                                                   @Nullable final PlayQueue queue) { | ||||||
|         final VideoDetailFragment instance = new VideoDetailFragment(); |         final VideoDetailFragment instance = new VideoDetailFragment(); | ||||||
|         instance.setInitialData(serviceId, videoUrl, name, queue); |         instance.setInitialData(serviceId, url, name, queue); | ||||||
|         return instance; |         return instance; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -1736,7 +1736,7 @@ public final class VideoDetailFragment | |||||||
|         playQueue = queue; |         playQueue = queue; | ||||||
|         if (DEBUG) { |         if (DEBUG) { | ||||||
|             Log.d(TAG, "onQueueUpdate() called with: serviceId = [" |             Log.d(TAG, "onQueueUpdate() called with: serviceId = [" | ||||||
|                     + serviceId + "], videoUrl = [" + url + "], name = [" |                     + serviceId + "], url = [" + url + "], name = [" | ||||||
|                     + title + "], playQueue = [" + playQueue + "]"); |                     + title + "], playQueue = [" + playQueue + "]"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -452,8 +452,12 @@ public final class NavigationHelper { | |||||||
|         if (fragment instanceof VideoDetailFragment && fragment.isVisible()) { |         if (fragment instanceof VideoDetailFragment && fragment.isVisible()) { | ||||||
|             onVideoDetailFragmentReady.run((VideoDetailFragment) fragment); |             onVideoDetailFragmentReady.run((VideoDetailFragment) fragment); | ||||||
|         } else { |         } 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 |             final VideoDetailFragment instance = VideoDetailFragment | ||||||
|                     .getInstance(serviceId, url, title, playQueue); |                     .getInstance(serviceId, null, title, playQueue); | ||||||
|             instance.setAutoPlay(autoPlay); |             instance.setAutoPlay(autoPlay); | ||||||
|  |  | ||||||
|             defaultTransaction(fragmentManager) |             defaultTransaction(fragmentManager) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox