fix(YouTube - Return YouTube Dislike): Wait until fetch is complete before allowing the first Short to start playback (#538)

This commit is contained in:
LisoUseInAIKyrios 2023-12-11 22:30:36 +04:00 committed by GitHub
parent 6f7a7b825e
commit 1c9c51ca5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -579,8 +579,6 @@ public class ReturnYouTubeDislikePatch {
}
final boolean waitForFetchToComplete = !IS_SPOOFING_TO_NON_LITHO_SHORTS_PLAYER
&& videoIdIsShort && !lastPlayerResponseWasShort;
lastPlayerResponseWasShort = videoIdIsShort;
lastPrefetchedVideoId = videoId;
LogHelper.printDebug(() -> "Prefetching RYD for video: " + videoId);
ReturnYouTubeDislike fetch = ReturnYouTubeDislike.getFetchForVideoId(videoId);
@ -594,8 +592,11 @@ public class ReturnYouTubeDislikePatch {
//
// If an asynchronous litho Shorts solution is found, then this blocking call should be removed.
LogHelper.printDebug(() -> "Waiting for prefetch to complete: " + videoId);
fetch.getFetchData(10000); // Use any arbitrarily large max wait time.
fetch.getFetchData(20000); // Any arbitrarily large max wait time.
}
// Set the fields after the fetch completes, so any concurrent calls will also wait.
lastPlayerResponseWasShort = videoIdIsShort;
lastPrefetchedVideoId = videoId;
} catch (Exception ex) {
LogHelper.printException(() -> "preloadVideoId failure", ex);
}