diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 47cf2d1b3..5b2ee5473 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -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); diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index 745319c98..a32183de0 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -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; } } diff --git a/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java index 63f6a400e..44f0a1b0e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainPlayer.java @@ -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 { diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java index 78a42875f..6781502ea 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java @@ -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);