Skips sponsored segments in YouTube videos using SponsorBlock data that native fetches. The feature owns everything that needs the DOM or player state; native owns trust, network, hashing, caching, user settings and remote config. The page sends an 11-character video ID and gets back that video's segments; how native produces them is invisible to the page by design.
Shipped in the Apple isolated-world bundle (contentScopeIsolated.js). The MVP is internal-only.
onConfigChanged, then calls getConfig. Nothing is requested or drawn until native says enabled. A rejected getConfig (no handler on this build) leaves the feature disabled.manual mode a button appears while playback is inside a segment and seeks to its end on click. It hides after 8 seconds and stays hidden until playback leaves that segment. In auto mode playback seeks past a segment as soon as it enters it naturally; a segment the user seeks into gets the button instead, so seeking back never re-skips.videoDuration differs from the player's duration by more than 2 s is ignored, since the video was re-cut after submission.adShowingSelectors) no markers are drawn, no button is shown and nothing is seeked.The feature activates in:
youtube.com and m.youtube.com;youtube-nocookie.com, which is how iOS Duck Player loads the video;youtube-nocookie.com frame whose ancestors are all nocookie pages, which is macOS Duck Player's embed.Embeds on any other site never activate it.
Schemas live in injected/src/messages/segment-skip/; npm run build-types -w injected generates the typed contract. The contract is versioned through getConfig's version, currently 1.
contentScopeScriptsIsolatedsegmentSkip| Method | Kind | Parameters | Result / payload |
|---|---|---|---|
getConfig |
request | {} |
{ enabled: boolean, skipMode: "manual" | "auto", version: number }. enabled is true only when the user opted in and the setting is on |
getSegments |
request | { videoID: string } |
{ segments: Segment[] } sorted by start; empty when the video has none or the feature is disabled. Native never rejects for lookup failures |
onConfigChanged |
subscription | { enabled, skipMode } |
pushed to every YouTube tab when the user changes a setting |
Segment is { start, end, category, actionType, uuid, videoDuration? }, times in seconds. Native chooses the categories and action types from remote config and user settings; the page does not ask for them.
"segmentSkip": {
"state": "internal",
"exceptions": [],
"settings": {
"progressBarSelectors": [".ytp-progress-bar", "..."],
"skipButtonHostSelectors": ["#player-container-id", "#player-controls", "#movie_player", ".html5-video-player"],
"adShowingSelectors": [".ad-showing"]
}
}
Each selector list is ordered: the first selector with a visible match wins. The feature falls back to in-code defaults when a key is absent, drops malformed entries, and treats an empty list as "no UI for this piece". categories and actionTypes are read by native only.
The feature loads only when the remote config names segmentSkip with a state that resolves to enabled for the platform; without an entry, or with disabled, its init never runs and no message is sent. To test before the entry ships, point the app at a custom privacy config that includes it.
injected/unit-test/segment-skip.js covers URL parsing, the frame rule, segment geometry, the duration check, selector settings and the config flow.injected/integration-test/segment-skip.spec.js (project apple-isolated) runs a fake player served under youtube.com URLs with mocked native responses, covering rendering, manual and auto skip, onConfigChanged, ads, navigation, selector miss and the frame rules.