mirror of
https://github.com/videojs/video.js.git
synced 2026-11-20 06:29:27 +01:00
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
3.8 KiB
3.8 KiB
@videojs/spf/features/chapters
Source: src/playback/features/chapters.ts
chaptersFeature
Adds the source's Apple JSON chapters (EXT-X-SESSION-DATA, com.apple.hls.chapters) to the media element as a
hidden chapters text track per language.
Behaviors
Config
Feature default is the value a feature's defaultConfig supplies. A behavior's own fallback for a key left unset is described under Doc.
| Key | Type | Feature default | Read by | Doc |
|---|---|---|---|---|
preferredSubtitleLanguage? |
string |
— | loadChapters | Preferred subtitle language (ISO 639 code, e.g., "en", "es"). If specified, selects matching track if available. |
requestCredentials? |
RequestCredentialsPolicy |
— | loadChapters | The credentials mode the engine's requests are made with: the manifest, media playlists, segments, and the chapters document; absent → the platform default. |
State
| Key | Type | Initial | Declared by | Doc |
|---|---|---|---|---|
presentation |
MaybeResolvedPresentation | undefined |
— | loadChapters | The presentation being played. A caller writes { url }; resolvePresentation parses the manifest and populates the rest. (documented on resolvePresentation) |
Context
| Key | Type | Declared by | Doc |
|---|---|---|---|
mediaElement |
HTMLMediaElement | undefined |
loadChapters | The media element the engine drives. No behavior writes it: an adapter attaches one with engine.context.mediaElement.set(element) and detaches with set(undefined), as SPF's adapters do. (documented on setupMediaSource) |
Composed by
- @videojs/spf/engines/hls-video
- @videojs/spf/engines/hls-audio
- @videojs/spf/engines/hls-video-mpeg-ts
- @videojs/spf/engines/hls-audio-mpeg-ts
Other functions and constants
| Name | Kind | Description | Source |
|---|---|---|---|
behaviors |
const | The behaviors the feature composes, in setup order. Listed under Behaviors. | src/playback/features/chapters.ts |
defaultConfig |
const | The config defaults the feature contributes. It contributes none ({}). |
src/playback/features/chapters.ts |
initialState |
const | The state values the feature seeds. It seeds none ({}). |
src/playback/features/chapters.ts |
Types
| Name | Kind | Description | Source |
|---|---|---|---|
Behaviors |
type | The type of behaviors. |
src/playback/features/chapters.ts |
Config |
type | Every config key the behaviors read. Listed under Config. | src/playback/features/chapters.ts |
Context |
type | Every context key the behaviors declare. Listed under Context. | src/playback/features/chapters.ts |
State |
type | Every state key the behaviors and external signals declare. Listed under State. | src/playback/features/chapters.ts |