refactor(youtube): remove obsolete fix-playback patch

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2023-02-01 20:57:48 +01:00
parent 319a234df6
commit 5ca042a602
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -1,40 +0,0 @@
package app.revanced.integrations.patches;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
public final class FixPlaybackPatch {
private static Thread currentThread = null;
private static String videoId;
public static void newVideoLoaded(final String videoId) {
if (!SettingsEnum.FIX_PLAYBACK.getBoolean()) return;
if (videoId.equals(FixPlaybackPatch.videoId)) return;
else FixPlaybackPatch.videoId = videoId;
if (currentThread != null) {
currentThread.interrupt();
}
currentThread = new Thread(() -> {
try {
while (true) {
var currentVideoTime = VideoInformation.getVideoTime();
if (currentVideoTime > -1) {
VideoInformation.seekTo(Integer.MAX_VALUE);
VideoInformation.seekTo(currentVideoTime);
return;
}
Thread.sleep(10);
}
} catch (InterruptedException e) {
LogHelper.printDebug(() -> "Thread was interrupted");
}
});
currentThread.start();
}
}