mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-19 02:19:23 +01:00
fix(YouTube - Client spoof): fix occasionally frozen video playback (#486)
This commit is contained in:
parent
ab9989d41f
commit
b0b6ff6a82
@ -68,6 +68,8 @@ public class SpoofSignaturePatch {
|
|||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
*
|
*
|
||||||
|
* Called off the main thread, and called multiple times for each video.
|
||||||
|
*
|
||||||
* @param parameters Original protobuf parameter value.
|
* @param parameters Original protobuf parameter value.
|
||||||
*/
|
*/
|
||||||
public static String spoofParameter(String parameters) {
|
public static String spoofParameter(String parameters) {
|
||||||
@ -96,9 +98,14 @@ public class SpoofSignaturePatch {
|
|||||||
|
|
||||||
String videoId = VideoInformation.getVideoId();
|
String videoId = VideoInformation.getVideoId();
|
||||||
if (!videoId.equals(currentVideoId)) {
|
if (!videoId.equals(currentVideoId)) {
|
||||||
currentVideoId = videoId;
|
|
||||||
rendererFuture = ReVancedUtils.submitOnBackgroundThread(() -> getStoryboardRenderer(videoId));
|
rendererFuture = ReVancedUtils.submitOnBackgroundThread(() -> getStoryboardRenderer(videoId));
|
||||||
|
currentVideoId = videoId;
|
||||||
}
|
}
|
||||||
|
// Occasionally when a new video is opened the video will be frozen a few seconds while the audio plays.
|
||||||
|
// This is because the main thread is calling to get the storyboard but the fetch is not completed.
|
||||||
|
// To prevent this, call get() here and block until the fetch is completed.
|
||||||
|
// So later when the main thread calls to get the renderer it will never block as the future is done.
|
||||||
|
getRenderer();
|
||||||
|
|
||||||
return INCOGNITO_PARAMETERS;
|
return INCOGNITO_PARAMETERS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user