SponsorBlock: Fixed some dumb issues related to storing video segments
This commit is contained in:
parent
8e7238cd54
commit
53f9e6b0a8
4 changed files with 7 additions and 9 deletions
|
@ -265,7 +265,6 @@ public final class VideoDetailFragment
|
|||
final MainPlayer connectedPlayerService,
|
||||
final boolean playAfterConnect) {
|
||||
player = connectedPlayer;
|
||||
player.setVideoSegments(videoSegments);
|
||||
|
||||
playerService = connectedPlayerService;
|
||||
|
||||
|
@ -1156,6 +1155,7 @@ public final class VideoDetailFragment
|
|||
playerService.getView().setVisibility(View.GONE);
|
||||
}
|
||||
addVideoPlayerView();
|
||||
playerService.setVideoSegments(videoSegments);
|
||||
|
||||
final Intent playerIntent = NavigationHelper
|
||||
.getPlayerIntent(requireContext(), MainPlayer.class, queue, true, autoPlayEnabled);
|
||||
|
|
|
@ -117,7 +117,6 @@ public abstract class BasePlayer implements
|
|||
@NonNull
|
||||
protected final SharedPreferences mPrefs;
|
||||
|
||||
private boolean wereSponsorsMarked;
|
||||
private VideoSegment[] videoSegments;
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1770,13 +1769,6 @@ public abstract class BasePlayer implements
|
|||
}
|
||||
|
||||
public void setVideoSegments(final VideoSegment[] videoSegments) {
|
||||
// use a flag to ignore null values later (i.e. when the video goes fullscreen)
|
||||
// TODO: there's probably a better way to deal with stuff like that
|
||||
if (wereSponsorsMarked) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.videoSegments = videoSegments;
|
||||
wereSponsorsMarked = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import androidx.core.content.ContextCompat;
|
|||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.util.ThemeHelper;
|
||||
import org.schabi.newpipe.util.VideoSegment;
|
||||
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
|
@ -254,6 +255,10 @@ public final class MainPlayer extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
public void setVideoSegments(final VideoSegment[] videoSegments) {
|
||||
playerImpl.setVideoSegments(videoSegments);
|
||||
}
|
||||
|
||||
|
||||
public class LocalBinder extends Binder {
|
||||
|
||||
|
|
|
@ -634,6 +634,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
}
|
||||
|
||||
final MarkableSeekBar markableSeekBar = (MarkableSeekBar) playbackSeekBar;
|
||||
markableSeekBar.seekBarMarkers.clear();
|
||||
|
||||
for (final VideoSegment segment : segments) {
|
||||
final Integer color = parseSegmentCategory(segment.category);
|
||||
|
|
Loading…
Reference in a new issue