Skip to main content

Interface: CastHandoff

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

The running handoff — one per app; dispose before creating another.

Properties

phase

readonly phase: CastHandoffPhase;

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

Current §3 phase.


receiverItemIndex

readonly receiverItemIndex: number | undefined;

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

Reconciled JS-queue index the receiver is on, while cast-active. undefined in every other phase — exactly one backend owns the cursor.

Methods

castTo()

castTo(deviceId: string): Promise<void>;

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

Cast the queue to deviceId (from getCastDevices). Resolves when the session is up (the handoff continues asynchronously — watch onPhaseChange); rejects invalid-state outside the local phase. On an already-connected session it reuses it and starts the handoff directly. Ordering note: call this before stopDiscovery().

Parameters

ParameterType
deviceIdstring

Returns

Promise<void>


dispose()

dispose(): void;

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

Detach every listener. Ends no session and restores nothing — this is teardown of the wiring, not of playback.

Returns

void


skipToItem()

skipToItem(jsIndex: number, position?: number): Promise<void>;

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

Jump the receiver to the castable item at JS index jsIndex.

Parameters

ParameterType
jsIndexnumber
position?number

Returns

Promise<void>


skipToNext()

skipToNext(): Promise<void>;

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

Advance to the next castable item (non-castable ones are inherently skipped).

Returns

Promise<void>


skipToPrevious()

skipToPrevious(): Promise<void>;

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

Returns

Promise<void>


stopCasting()

stopCasting(options?: EndSessionOptions): Promise<void>;

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

End the session. Default (transferBackToLocal: true): stop the receiver and resume locally at the receiver's projected position; resolves when the machine is back in local (restore issued). transferBackToLocal: false: disconnect and leave the receiver playing. Idempotent in local; rejects invalid-state mid-handoff.

Parameters

ParameterType
options?EndSessionOptions

Returns

Promise<void>


syncQueue()

syncQueue(): void;

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

The JS queue changed while casting: re-project and reload the receiver queue, anchored at the receiver's current item and projected position. No-op outside cast-active.

Returns

void