SponsorBlock API
Community skip segments from SponsorBlock apply to local files, same idea as the browser extension, without streaming from YouTube.
When you press play, useSponsorBlockPlayback invokes ensure_sponsorblock_segments with the file path. Rust reads {stem}.sponsorblock.json beside the video if it exists. The YouTube video id comes from the yt-dlp .info.json sidecar (sourceId on the frontend). No id means no fetch; playback continues normally.
Stale or missing sidecars trigger an API call. sponsorblock_fetch_query sends every category RuForge cares about (sponsor, selfpromo, intro, outro, preview, filler, interaction, music_offtopic, poi_highlight, chapter, etc.), not the API default sponsor-only set. Failures are silent: cached segments keep working offline.
During playback the hook watches currentTime. Categories set to auto in Settings → Playback seek past segment ends. button mode shows SponsorBlockSkipButton instead. Adaptive learning adjusts per-category behavior over time based on manual skips and undo windows. Scrub overlays in SponsorBlockScrubOverlay.tsx and chapter ticks in ChapterScrubber.tsx paint the same color map as the official extension.
Sidecars mean repeat plays skip the network unless you force refresh. Mini player layouts with a scrub bar get the same overlays; compact micro layouts without a scrub bar do not.
In the repo
Where it shows up
-
src-tauri/src/commands/sponsorblock.rsfetch, normalize, sidecar read/write -
useSponsorBlockPlayback.tsload on play, auto-skip, button mode -
SponsorBlockSettingsTree.tsxunder Settings → Playback -
SponsorBlockScrubOverlay.tsx,SponsorBlockSkipButton.tsx,sponsorBlockColors.ts