Skip to main content

Type Alias: CastHandoffState

type CastHandoffState =
| {
phase: "local";
}
| {
phase: "connecting";
}
| {
itemIds: readonly number[];
loaded: boolean;
phase: "handoff-to-cast";
projection: CastQueueProjection;
snapshot: CastHandoffQueueSnapshot;
}
| {
anchor: ReceiverAnchor;
duration?: number;
itemIds: readonly number[];
itemIndex: number;
jsIndices: readonly number[];
liveJsIndices: readonly number[];
pendingProjection?: CastQueueProjection;
phase: "cast-active";
playWhenReady: boolean;
}
| {
awaiting: "session-end" | "local-restore";
itemIndex: number;
live: boolean;
phase: "handoff-to-local";
playWhenReady: boolean;
position: number;
transferBack: boolean;
};

Defined in: packages/cast/src/handoff-machine.ts:289

Union Members​

Type Literal​

{
phase: "local";
}

Type Literal​

{
phase: "connecting";
}

Type Literal​

{
itemIds: readonly number[];
loaded: boolean;
phase: "handoff-to-cast";
projection: CastQueueProjection;
snapshot: CastHandoffQueueSnapshot;
}

itemIds​

readonly itemIds: readonly number[];

loaded​

readonly loaded: boolean;

queueLoad acknowledged; waiting for the receiver's first real status.

phase​

readonly phase: "handoff-to-cast";

projection​

readonly projection: CastQueueProjection;

snapshot​

readonly snapshot: CastHandoffQueueSnapshot;

Type Literal​

{
anchor: ReceiverAnchor;
duration?: number;
itemIds: readonly number[];
itemIndex: number;
jsIndices: readonly number[];
liveJsIndices: readonly number[];
pendingProjection?: CastQueueProjection;
phase: "cast-active";
playWhenReady: boolean;
}

anchor​

readonly anchor: ReceiverAnchor;

duration?​

readonly optional duration?: number;

itemIds​

readonly itemIds: readonly number[];

Receiver-assigned ids, queue order — one half of the reconciliation map.

itemIndex​

readonly itemIndex: number;

Current JS index, reconciled from the last currentItemId.

jsIndices​

readonly jsIndices: readonly number[];

jsIndices[p] is the JS index behind receiver queue position p.

liveJsIndices​

readonly liveJsIndices: readonly number[];

JS indices whose items are live streams — queue truth carried so a transfer-back can mark its restore live (no seek). Independent of the receiver mapping, so a resync refreshes it immediately.

pendingProjection?​

readonly optional pendingProjection?: CastQueueProjection;

A resync's projection, adopted when its castQueueLoaded lands.

phase​

readonly phase: "cast-active";

playWhenReady​

readonly playWhenReady: boolean;

The receiver's advance intent — what a transfer-back resumes per.


Type Literal​

{
awaiting: "session-end" | "local-restore";
itemIndex: number;
live: boolean;
phase: "handoff-to-local";
playWhenReady: boolean;
position: number;
transferBack: boolean;
}

awaiting​

readonly awaiting: "session-end" | "local-restore";

itemIndex​

readonly itemIndex: number;

live​

readonly live: boolean;

The restore target is live — see the restoreLocal effect's doc.

phase​

readonly phase: "handoff-to-local";

playWhenReady​

readonly playWhenReady: boolean;

position​

readonly position: number;

transferBack​

readonly transferBack: boolean;