Skip to main content

Interface: WireCastHandoffOptions

Defined in: packages/cast/src/handoff.ts:58

Properties

cast?

optional cast?: CastApi;

Defined in: packages/cast/src/handoff.ts:66

Injectable for tests; defaults to the process-wide Cast facade.


handoffTimeoutMs?

optional handoffTimeoutMs?: number;

Defined in: packages/cast/src/handoff.ts:105

Upper bound on the handoff-to-cast phase. If the receiver has not produced a queue-load ack AND a first status by then, the machine falls back to LOCAL at the pre-handoff snapshot with a typed load-failed — an honest error instead of a hang. Device truth behind the number: a healthy load acks in under a second on a LAN, but a queueLoad issued against a just-rejoined session was observed to never settle at all (see CastController.attach's requestStatus priming — this timeout is the belt to that suspender). A JS timer is legal here for the same reason it is in the example's restore waits: a handoff is user-initiated and foreground.

Default

15_000

now?

optional now?: () => number;

Defined in: packages/cast/src/handoff.ts:91

Clock, injectable for tests.

Returns

number

Default

Date.now

onError?

optional onError?: (error: CastError) => void;

Defined in: packages/cast/src/handoff.ts:89

Every typed failure: session starts, receiver fetches (cast-receiver-fetch — the re-resolve-and-reload hook), fallbacks. Defaults to console.error; errors are never swallowed.

Parameters

ParameterType
errorCastError

Returns

void


onItemsSkipped?

optional onItemsSkipped?: (skipped: readonly SkippedCastItem[]) => void;

Defined in: packages/cast/src/handoff.ts:83

Queue items the projection had to skip — typed, surfaced, never silent.

Parameters

ParameterType
skippedreadonly SkippedCastItem[]

Returns

void


onPhaseChange?

optional onPhaseChange?: (phase: CastHandoffPhase) => void;

Defined in: packages/cast/src/handoff.ts:68

The §3 phase moved. Fires only on change.

Parameters

ParameterType
phaseCastHandoffPhase

Returns

void


onReceiverState?

optional onReceiverState?: (snapshot: CastReceiverSnapshot) => void;

Defined in: packages/cast/src/handoff.ts:81

The receiver's state, reconciled to JS-queue vocabulary, as a position anchor. While cast-active this is the app's ONLY truthful source for its playbackState/mediaItem broadcasts; between calls, project from {position, at, rate} — never poll.

Parameters

ParameterType
snapshotCastReceiverSnapshot

Returns

void


onTransfer?

optional onTransfer?: (transfer: CastTransferEvent) => void;

Defined in: packages/cast/src/handoff.ts:74

A transfer discontinuity — {direction, position, itemIndex} — exactly one per direction per handoff. Route into your app's castTransfer event / analytics; position ownership changed hands at this instant.

Parameters

ParameterType
transferCastTransferEvent

Returns

void


snapshot

snapshot: () => CastHandoffQueueSnapshot;

Defined in: packages/cast/src/handoff.ts:64

One coherent read of the JS queue: items (with receiver-fetchable URLs — resolve signed/logical URLs here), cursor, position, intent. Called at handoff time and on CastHandoff.syncQueue; never polled.

Returns

CastHandoffQueueSnapshot