mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-05-02 15:44:40 +02:00
fix(fix-playback): seek to maximum end
This commit is contained in:
parent
6aa0ca9556
commit
fd69010def
@ -1,33 +1,37 @@
|
|||||||
package app.revanced.integrations.patches;
|
package app.revanced.integrations.patches;
|
||||||
|
|
||||||
import java.util.Timer;
|
|
||||||
|
|
||||||
import app.revanced.integrations.settings.SettingsEnum;
|
import app.revanced.integrations.settings.SettingsEnum;
|
||||||
import app.revanced.integrations.utils.LogHelper;
|
import app.revanced.integrations.utils.LogHelper;
|
||||||
|
|
||||||
public final class FixPlaybackPatch {
|
public final class FixPlaybackPatch {
|
||||||
private static Thread currentThread = null;
|
private static Thread currentThread = null;
|
||||||
public static void newVideoLoaded(final String _videoId) {
|
private static String videoId;
|
||||||
|
|
||||||
|
public static void newVideoLoaded(final String videoId) {
|
||||||
if (!SettingsEnum.FIX_PLAYBACK.getBoolean()) return;
|
if (!SettingsEnum.FIX_PLAYBACK.getBoolean()) return;
|
||||||
|
|
||||||
|
if (videoId.equals(FixPlaybackPatch.videoId)) return;
|
||||||
|
else FixPlaybackPatch.videoId = videoId;
|
||||||
|
|
||||||
if (currentThread != null) {
|
if (currentThread != null) {
|
||||||
currentThread.interrupt();
|
currentThread.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
currentThread = new Thread(() -> {
|
currentThread = new Thread(() -> {
|
||||||
while (true) {
|
try {
|
||||||
var currentVideoLength = PlayerControllerPatch.getCurrentVideoLength();
|
while (true) {
|
||||||
if (currentVideoLength > 1) {
|
var currentVideoTime = VideoInformation.getVideoTime();
|
||||||
PlayerControllerPatch.seekTo(currentVideoLength);
|
|
||||||
PlayerControllerPatch.seekTo(1);
|
if (currentVideoTime > -1) {
|
||||||
return;
|
VideoInformation.seekTo(Integer.MAX_VALUE);
|
||||||
}
|
VideoInformation.seekTo(currentVideoTime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
} catch (InterruptedException e) {
|
|
||||||
LogHelper.debug(FixPlaybackPatch.class, "Thread was interrupted");
|
|
||||||
}
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
LogHelper.debug(FixPlaybackPatch.class, "Thread was interrupted");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user