Files
v10/dist/dev/playback/primitives/text-segment-load-pipeline.js
T

37 lines
1.5 KiB
JavaScript

//#region src/playback/primitives/text-segment-load-pipeline.ts
/**
* Base-step view of the loader's wiring, folded into `config` by
* `createTextTrackSegmentLoaderActor` so base steps read it from the uniform passthrough
* — present in both composition and standalone use. `config` is loose (`object`), so
* assert the shape here (mirrors the v/a loader's `stepWiring`). The sink is the
* structural {@link CueSink}, not the concrete actor.
*/
function textStepWiring(deps) {
return deps.config;
}
/** Resolve the op's cues (via the injected host primitive) into the frame. The text analog of `fetchStep`. */
const resolveCuesStep = async (frame, signal, deps) => {
const cues = await textStepWiring(deps).resolveSegment(frame.op.segment.url);
if (signal.aborted) return;
frame.cues = cues;
};
/** Dispatch the frame's cues to the TextTracksActor as `add-cues`. The text analog of `dispatchStep`. */
const dispatchCuesStep = (frame, _signal, deps) => {
const { op } = frame;
textStepWiring(deps).textTracksActor.send({
type: "add-cues",
meta: {
trackId: op.trackId,
id: op.segment.id,
startTime: op.segment.startTime,
duration: op.segment.duration
},
cues: frame.cues ?? []
});
};
/** Tier 0 default: resolve then dispatch. No relocation vocabulary. */
const DEFAULT_TEXT_MESSAGE_PIPELINES = () => [resolveCuesStep, dispatchCuesStep];
//#endregion
export { DEFAULT_TEXT_MESSAGE_PIPELINES, dispatchCuesStep, resolveCuesStep, textStepWiring };
//# sourceMappingURL=text-segment-load-pipeline.js.map