From a9e2ff2dc668c470387a497684ddb18bb17e971d Mon Sep 17 00:00:00 2001
From: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Sun, 1 Feb 2026 13:44:59 -0700
Subject: [PATCH] fix skip section buttons not showing
---
.../player/atoms/NextEpisodeButton.tsx | 5 +-
.../player/atoms/SkipSegmentButton.tsx | 129 +++++++-------
src/components/player/hooks/useSkipTime.ts | 166 +++++++++++-------
3 files changed, 174 insertions(+), 126 deletions(-)
diff --git a/src/components/player/atoms/NextEpisodeButton.tsx b/src/components/player/atoms/NextEpisodeButton.tsx
index a59d2efb..f18c89bd 100644
--- a/src/components/player/atoms/NextEpisodeButton.tsx
+++ b/src/components/player/atoms/NextEpisodeButton.tsx
@@ -96,6 +96,8 @@ export function NextEpisodeButton(props: {
onChange?: (meta: PlayerMeta) => void;
inControl: boolean;
showAsButton?: boolean;
+ /** When true (e.g. in credits-to-end segment), show regardless of time/duration. */
+ forceShow?: boolean;
}) {
const { t } = useTranslation();
const duration = usePlayerStore((s) => s.progress.duration);
@@ -109,7 +111,8 @@ export function NextEpisodeButton(props: {
const setLastSuccessfulSource = usePreferencesStore(
(s) => s.setLastSuccessfulSource,
);
- const showingState = shouldShowNextEpisodeButton(time, duration);
+ const timeBasedState = shouldShowNextEpisodeButton(time, duration);
+ const showingState = props.forceShow ? "always" : timeBasedState;
const status = usePlayerStore((s) => s.status);
const setShouldStartFromBeginning = usePlayerStore(
(s) => s.setShouldStartFromBeginning,
diff --git a/src/components/player/atoms/SkipSegmentButton.tsx b/src/components/player/atoms/SkipSegmentButton.tsx
index ab34645a..f5440e4e 100644
--- a/src/components/player/atoms/SkipSegmentButton.tsx
+++ b/src/components/player/atoms/SkipSegmentButton.tsx
@@ -86,18 +86,18 @@ function SkipSegmentButton(props: {
const meta = usePlayerStore((s) => s.meta);
const { addSkipEvent } = useSkipTracking(20);
- // Check if we should show NextEpisodeButton instead of credits skip button
+ // Only replace with NextEpisodeButton when credits have no end (end_ms === null) – i.e. credits
+ // run to the end of the video. When end_ms is a number, there may be content after (e.g. post-
+ // credits scene), so we show the normal "Skip credits" button that seeks to end_ms.
const shouldShowNextEpisodeInsteadOfCredits =
meta?.type === "show" &&
props.segments.some((segment) => {
if (segment.type !== "credits") return false;
- // Show NextEpisodeButton if credits end at video end (null means end of video)
return segment.end_ms === null;
});
- // Find segments that should be shown at the current time
+ // Find segments that should be shown at the current time (intro, recap; credits excluded when we show NextEpisodeButton)
const activeSegments = props.segments.filter((segment) => {
- // Skip credits segments if we're showing NextEpisodeButton instead
if (segment.type === "credits" && shouldShowNextEpisodeInsteadOfCredits) {
return false;
}
@@ -105,6 +105,17 @@ function SkipSegmentButton(props: {
return showingState !== "none";
});
+ // NextEpisodeButton only for the "credits to end of video" segment (end_ms === null)
+ const creditsSegment = props.segments.find(
+ (s) => s.type === "credits" && s.end_ms === null,
+ );
+ const inCreditsSegment =
+ creditsSegment != null && time * 1000 >= (creditsSegment.start_ms ?? 0);
+ const showNextEpisodeButton =
+ shouldShowNextEpisodeInsteadOfCredits &&
+ props.inControl &&
+ inCreditsSegment;
+
const handleSkip = useCallback(
(segment: SegmentData) => {
if (!display) return;
@@ -146,70 +157,70 @@ function SkipSegmentButton(props: {
[display, time, _duration, addSkipEvent, meta, props],
);
- // Show NextEpisodeButton instead of credits skip button for TV shows when credits end at video end
- if (shouldShowNextEpisodeInsteadOfCredits && props.inControl) {
- return (
-
- );
- }
-
- if (!props.inControl || activeSegments.length === 0) return null;
-
- // If status is not playing, don't show buttons
+ if (!props.inControl) return null;
if (status !== "playing") return null;
+ if (activeSegments.length === 0 && !showNextEpisodeButton) return null;
return (
-