Files
video.js-mirror/packages/spf/docs/reference/features/shift-timestamps.md

4.8 KiB

@videojs/spf/features/shift-timestamps

Source: src/playback/features/shift-timestamps.ts

shiftTimestampsFeature

Plays HLS content whose segment timestamps don't start at zero, by shifting them onto the playlist's zero-based timeline. Without it, such content strands the playhead outside the buffered ranges; content that starts at zero doesn't need it. Text cues shift with shiftTextTimestampsFeature, composed alongside it and textTracksFeature.

Behaviors

  1. establishStartMediaTime

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
audioMessagePipelines MessagePipelines relocationPipelinesFor('audio') setupAudioBufferActors Optional pipelines that relocate segments whose timestamps don't start at zero; absent, segments append as-is.
deriveStartMediaTime? DeriveStartMediaTime deriveSharedMinStartMediaTime establishStartMediaTime The reduce seam (coordination knob). Defaults to deriveSharedMinStartMediaTime.
videoMessagePipelines MessagePipelines relocationPipelinesFor('video') setupVideoBufferActors Optional pipelines that relocate segments whose timestamps don't start at zero; absent, segments append as-is.

State

Key Type Initial Declared by Doc
mediaContainerData Record<string, MediaContainerData> | undefined — establishStartMediaTime Transient origin-establishment data, keyed by track type ('video' / 'audio') — per spec one init+media pair per type suffices, and ABR rungs of a type share the origin. Filled by the discover steps across appends, reset per source. Never the model — the churn stays here; only the settled startMediaTime reaches Track.
presentation MaybeResolvedPresentation | undefined — establishStartMediaTime The presentation being played. A caller writes { url }; resolvePresentation parses the manifest and populates the rest. (documented on resolvePresentation)

Composed by

Other functions and constants

Name Kind Description Source
behaviors const The behaviors the feature composes, in setup order. Listed under Behaviors. src/playback/features/shift-timestamps.ts
defaultConfig const The config defaults the feature contributes. Its value: { deriveStartMediaTime: deriveSharedMinStartMediaTime, videoMessagePipelines: relocationPipelinesFor('video'), audioMessagePipelines: relocationPipelinesFor('audio') }. src/playback/features/shift-timestamps.ts
initialState const The state values the feature seeds. It seeds none ({}). src/playback/features/shift-timestamps.ts

Types

Name Kind Description Source
Behaviors type The type of behaviors. src/playback/features/shift-timestamps.ts
Config type Every config key the behaviors read. Listed under Config. src/playback/features/shift-timestamps.ts
Context type Every context key the behaviors declare. src/playback/features/shift-timestamps.ts
State type Every state key the behaviors and external signals declare. Listed under State. src/playback/features/shift-timestamps.ts