PrismCore / API reference / Subtitles and captions

Structure

TimedTextCue

struct TimedTextCue

Declared in Sources/PrismCore/Subtitles/TimedTextCue.swift · PrismCore 3.5.4

One timed text cue of an embedded subtitle stream, handed to the host as the demux produces it — the host-facing twin of the internal SubtitleCue.

Exists because the WebVTT renditions are not always the right delivery for text: AVPlayer times a SUBTITLES rendition on its own segment schedule, which is where the late-cue drift class of bugs lives, while a host that draws captions itself wants the cue list on the player's own clock. Plex's subtitle-only transcode turned out to answer empty documents for embedded tracks (Aether#1533), so "ask the server for the text" is not a route — the demux this engine already runs is the one honest source of embedded cues.

Times are seconds on the producer's playback clock. Remux callbacks subtract the source's presentation origin for comparison with AVPlayerItem.currentTime(). SoftwarePlaybackPipeline.activeSubtitleCues keeps source timestamps, matching that pipeline's currentTime.

Initializers

init(streamIndex: Int32, start: Double, end: Double, text: String, placement: TextCuePlacement? = nil)

No documentation comment in the source.

Instance properties

let streamIndex: Int32

The source stream this cue came from — the same index SubtitleTrackInfo.streamIndex reports, so a host can route cues to the track the viewer selected.

let start: Double

Seconds on the producing pipeline's playback clock (see above).

let end: Double

No documentation comment in the source.

let text: String

Cue payload as the converter produced it — WebVTT-safe plain text, possibly carrying simple inline tags (<i>, <b>, <u>) the source had, including ones translated from ASS {\i1}-style overrides.

let placement: TextCuePlacement?

Where the source asked for the cue to be drawn (an ASS \an8, a WebVTT line:), or nil for the host's default placement — which is what nearly every cue wants. A host that ignores it draws exactly what it drew before.

Generated from the public symbols of PrismCore 3.5.4. All types