Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
SponsorBlock: Fixed some dumb issues related to storing video segments
Browse files Browse the repository at this point in the history
  • Loading branch information
polymorphicshade committed Dec 12, 2020
1 parent 8e7238c commit 53f9e6b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ public void onServiceConnected(final VideoPlayerImpl connectedPlayer,
final MainPlayer connectedPlayerService,
final boolean playAfterConnect) {
player = connectedPlayer;
player.setVideoSegments(videoSegments);

playerService = connectedPlayerService;

Expand Down Expand Up @@ -1156,6 +1155,7 @@ private void openMainPlayer() {
playerService.getView().setVisibility(View.GONE);
}
addVideoPlayerView();
playerService.setVideoSegments(videoSegments);

final Intent playerIntent = NavigationHelper
.getPlayerIntent(requireContext(), MainPlayer.class, queue, true, autoPlayEnabled);
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/java/org/schabi/newpipe/player/BasePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public abstract class BasePlayer implements
@NonNull
protected final SharedPreferences mPrefs;

private boolean wereSponsorsMarked;
private VideoSegment[] videoSegments;

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1770,13 +1769,6 @@ public VideoSegment[] getVideoSegments() {
}

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;
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/org/schabi/newpipe/player/MainPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

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;

Expand Down Expand Up @@ -254,6 +255,10 @@ public void removeViewFromParent() {
}
}

public void setVideoSegments(final VideoSegment[] videoSegments) {
playerImpl.setVideoSegments(videoSegments);
}


public class LocalBinder extends Binder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ private void markSegments() {
}

final MarkableSeekBar markableSeekBar = (MarkableSeekBar) playbackSeekBar;
markableSeekBar.seekBarMarkers.clear();

for (final VideoSegment segment : segments) {
final Integer color = parseSegmentCategory(segment.category);
Expand Down

0 comments on commit 53f9e6b

Please sign in to comment.