fixed (?) possible duplicate segment skips
This commit is contained in:
parent
d60574581b
commit
6e3e5e8114
2 changed files with 16 additions and 1 deletions
|
@ -46,6 +46,7 @@ public class LocalPlayer implements EventListener {
|
|||
private VideoSegment[] videoSegments;
|
||||
private LocalPlayerListener listener;
|
||||
private int lastCurrentProgress = -1;
|
||||
private int lastSkipTarget = -1;
|
||||
|
||||
public LocalPlayer(final Context context) {
|
||||
this.context = context;
|
||||
|
@ -248,6 +249,7 @@ public class LocalPlayer implements EventListener {
|
|||
|
||||
final VideoSegment segment = getSkippableSegment(currentProgress);
|
||||
if (segment == null) {
|
||||
lastSkipTarget = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -259,6 +261,12 @@ public class LocalPlayer implements EventListener {
|
|||
skipTarget = 0;
|
||||
}
|
||||
|
||||
if (lastSkipTarget == skipTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
lastSkipTarget = skipTarget;
|
||||
|
||||
// temporarily force EXACT seek parameters to prevent infinite skip looping
|
||||
final SeekParameters seekParams = simpleExoPlayer.getSeekParameters();
|
||||
simpleExoPlayer.setSeekParameters(SeekParameters.EXACT);
|
||||
|
|
|
@ -383,7 +383,7 @@ public final class Player implements
|
|||
// SponsorBlock
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
private SponsorBlockMode sponsorBlockMode = SponsorBlockMode.DISABLED;
|
||||
|
||||
private int lastSkipTarget = -1;
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1563,6 +1563,7 @@ public final class Player implements
|
|||
if (sponsorBlockMode == SponsorBlockMode.ENABLED) {
|
||||
final VideoSegment segment = getSkippableSegment(currentProgress);
|
||||
if (segment == null) {
|
||||
lastSkipTarget = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1574,6 +1575,12 @@ public final class Player implements
|
|||
skipTarget = 0;
|
||||
}
|
||||
|
||||
if (lastSkipTarget == skipTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
lastSkipTarget = skipTarget;
|
||||
|
||||
// temporarily force EXACT seek parameters to prevent infinite skip looping
|
||||
final SeekParameters seekParams = simpleExoPlayer.getSeekParameters();
|
||||
simpleExoPlayer.setSeekParameters(SeekParameters.EXACT);
|
||||
|
|
Loading…
Reference in a new issue