mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-30 15:52:55 +01:00
fix(YouTube - SponsorBlock): Do not auto skip end segments more than once if using a slow playback speed
This commit is contained in:
parent
5ae2312804
commit
88b3ca4992
@ -510,16 +510,19 @@ public class SegmentPlaybackController {
|
||||
SponsorBlockViewController.hideSkipHighlightButton();
|
||||
SponsorBlockViewController.hideSkipSegmentButton();
|
||||
|
||||
final long now = System.currentTimeMillis();
|
||||
if (lastSegmentSkipped == segmentToSkip) {
|
||||
// If trying to seek to end of the video, YouTube can seek just before of the actual end.
|
||||
// (especially if the video does not end on a whole second boundary).
|
||||
// This causes additional segment skip attempts, even though it cannot seek any closer to the desired time.
|
||||
// Check for and ignore repeated skip attempts of the same segment over a small time period.
|
||||
final long now = System.currentTimeMillis();
|
||||
final long minimumMillisecondsBetweenSkippingSameSegment = 500;
|
||||
if ((lastSegmentSkipped == segmentToSkip) && (now - lastSegmentSkippedTime < minimumMillisecondsBetweenSkippingSameSegment)) {
|
||||
final long minTimeBetweenSkippingSameSegment = Math.max(500,
|
||||
(long) (500 / VideoInformation.getPlaybackSpeed()));
|
||||
if (now - lastSegmentSkippedTime < minTimeBetweenSkippingSameSegment) {
|
||||
LogHelper.printDebug(() -> "Ignoring skip segment request (already skipped as close as possible): " + segmentToSkip);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogHelper.printDebug(() -> "Skipping segment: " + segmentToSkip);
|
||||
lastSegmentSkipped = segmentToSkip;
|
||||
|
Loading…
Reference in New Issue
Block a user