mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
33 lines
1.6 KiB
TypeScript
33 lines
1.6 KiB
TypeScript
import { Cue, Segment } from "../../media/types/index.js";
|
|
import { TransitionActor } from "../../core/actors/create-transition-actor.js";
|
|
import { AddCuesMessage } from "../primitives/text-track-messages.js";
|
|
//#region src/playback/actors/text-tracks.d.ts
|
|
/** Non-finite (extended) data managed by the actor — the XState "context". */
|
|
interface TextTracksActorContext {
|
|
/** Cues added per track ID. Used for duplicate detection and snapshot observability. */
|
|
loaded: Record<string, Cue[]>;
|
|
/** Segments whose cues have been fully added, keyed by track ID. Used for load planning. */
|
|
segments: Record<string, Array<Pick<Segment, 'id' | 'startTime' | 'duration'>>>;
|
|
}
|
|
/**
|
|
* Wipe the actor's `loaded` + `segments` context. Sent on source reset
|
|
* (typically by `syncTextTracks` on state exit) so a subsequent
|
|
* presentation starts with a fresh cue+segment cache. Without this, a
|
|
* new presentation reusing trackIds from the prior source would have
|
|
* `getSegmentsToLoad` treat its segments as already-buffered and skip
|
|
* loading them.
|
|
*/
|
|
interface ClearMessage {
|
|
type: 'clear';
|
|
}
|
|
type TextTracksActorMessage<C extends Cue = Cue> = AddCuesMessage<C> | ClearMessage;
|
|
/**
|
|
* Host-agnostic text-track actor type.
|
|
*
|
|
* Generic over the concrete cue shape `C` so DOM hosts (using `VTTCue`)
|
|
* and non-DOM hosts (custom cue representations) can both satisfy it.
|
|
*/
|
|
type TextTracksActor<C extends Cue = Cue> = TransitionActor<TextTracksActorContext, TextTracksActorMessage<C>>;
|
|
//#endregion
|
|
export { ClearMessage, TextTracksActor, TextTracksActorContext, TextTracksActorMessage };
|
|
//# sourceMappingURL=text-tracks.d.ts.map
|