Skip to content

Show and allow skipping between embedded video chapters - #201

Closed
Kombustor wants to merge 1 commit into
mainfrom
fix/various-bugs-and-issues
Closed

Kombustor wants to merge 1 commit into
mainfrom
fix/various-bugs-and-issues

Conversation

@Kombustor

Copy link
Copy Markdown
Contributor

No description provided.

@Kombustor
Kombustor force-pushed the fix/various-bugs-and-issues branch from ef5b59d to 7747cb6 Compare September 13, 2026 21:40
@Kombustor Kombustor changed the title Fix/various bugs and issues Show and allow skipping between embedded video chapters Sep 13, 2026
Comment on lines +784 to +793
const handleChapterNavigate = useCallback(
(direction: 'left' | 'right', currentChapter: VideoChapter) => {
const chapterIndex = chapters?.findIndex(
(chapter) =>
chapter.startTime === currentChapter.startTime &&
chapter.endTime === currentChapter.endTime
);
if (chapterIndex === undefined || chapterIndex < 0) return;

const nextChapterIndex = chapterIndex + (direction === 'right' ? 1 : -1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Chapter navigation on TV can call onSeek(NaN) if adjacent chapter data is invalid, potentially crashing the player or corrupting watch history.
Severity: HIGH

Suggested Fix

The handleChapterNavigate function should use the same filtered list of valid chapters that the UI uses for navigation, rather than the raw chapters prop. Alternatively, explicitly validate that nextChapter.startTime is a finite number before calling onSeek.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/components/video/PlayerControls.tsx#L784-L793

Potential issue: The `handleChapterNavigate` function, used for TV d-pad navigation,
identifies the current chapter within the raw, unfiltered `chapters` array. It then
attempts to navigate to the adjacent chapter in that same raw array. If the video source
provides malformed metadata where an adjacent chapter has an invalid `startTime` (e.g.,
`NaN`), the function will call `onSeek` with this invalid value. This can lead to a
native player crash or corruption of the user's watch history by persisting `NaN` as the
progress.

Also affects:

  • src/components/video/ChapterLabel.tsx:1~296

Did we get this right? 👍 / 👎 to inform future reviews.

@Kombustor Kombustor closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant