feat(core): make chapters activate on YouTube & Vimeo (#52) - #53
Merged
Merged
Conversation
The chapter artifacts from #35 were emitted without respecting the upload platforms' activation rules, so they could silently fail: - YouTube ignores the ENTIRE description chapter list if any single chapter is under 10s. Add `enforceMinChapterDuration` and fold sub-10s chapters into a neighbor for the `.chapters.txt` output (a too-short chapter merges into the prior one; a too-short first chapter folds forward so playback still opens inside a chapter). The MP4 track and the `.chapters.vtt` keep the full per-step list — those players have no minimum-chapter rule. - Vimeo caps chapter titles at 50 chars; our default was 60. Lower the default title cap to 50 so titles are safe on the strictest target. Docs: reconcile the existing chapter sections (which mentioned the 3-chapter rule but not the 10s floor) and add a "Getting chapters onto YouTube and Vimeo" guide. No public API change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- e2e: the integration gate still asserted the pre-fold .txt contract (line count, "0:00 Objectives" first, "Recap" last). The getting-started cards are < 10s so they now fold in the .txt — move the full-list contract onto the .vtt (which keeps every chapter) and assert the ≥10s floor + 0:00 start on the .txt. Verified: full e2e gate passes. - Export enforceMinChapterDuration + YOUTUBE_MIN_CHAPTER_MS from index.ts for parity with the other chapter helpers. - CHANGELOG: the 60→50 title-cap default is an observable behavior change, not "no API change" — reword and note the new exports. - Tests: add trailing-double-short fold, the composed intro+recap card scenario, and a floor/contiguity/0-start invariant check. - Reword the fold comment that overstated the 0-start guarantee. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52.
Problem
The chapter artifacts shipped in #35 were emitted without respecting the activation rules of the platforms authors actually upload to, so they could silently fail:
Changes
enforceMinChapterDuration(chapters, minMs)(new, exported) folds any chapter shorter than the floor into a neighbor: a too-short chapter merges into the one before it (which keeps its title and extends), and a too-short first chapter folds forward into the next (whose start is pulled to 0 so playback still opens inside a chapter). Chains collapse cleanly; a single surviving chapter is allowed (we never invent boundaries)..chapters.txtonly (YOUTUBE_MIN_CHAPTER_MS = 10_000). The MP4 track and.chapters.vtt(Vimeo/web) keep the full per-step list — those players have no minimum-chapter rule, and this preserves the short Objectives/Recap card chapters there.getting-started.md,writing-tutorials.md).Tests
7 new unit tests cover the fold cases (interior → previous, first → forward, trailing, chain-collapse, no-op paths) and the 50-char default cap. Full suite: 165 unit tests pass;
pnpm buildclean.Notes
forge publish→ Vimeo) inherits safe artifacts.🤖 Generated with Claude Code