Type Alias: CastHandoffEvent
type CastHandoffEvent =
| {
deviceId: string;
type: "start";
}
| {
at: number;
transferBack: boolean;
type: "end";
}
| {
at: number;
snapshot: CastHandoffQueueSnapshot;
type: "resync";
}
| {
at: number;
snapshot: CastHandoffQueueSnapshot;
type: "sessionStarted";
}
| {
error: CastError;
type: "sessionStartFailed";
}
| {
at: number;
type: "sessionEnded";
}
| {
at: number;
type: "sessionSuspended";
}
| {
at: number;
itemIds: readonly number[];
type: "castQueueLoaded";
}
| {
at: number;
itemIds: readonly number[];
type: "queueItemIds";
}
| {
error: CastError;
type: "castQueueLoadFailed";
}
| {
at: number;
status: NativeCastMediaStatusEvent;
type: "mediaStatus";
}
| {
error: CastError;
type: "castError";
}
| {
type: "localRestored";
}
| {
error: CastError;
type: "localRestoreFailed";
};
Defined in: packages/cast/src/handoff-machine.ts:184
Everything that can move the machine. at fields are stamped by the caller
(the orchestrator) so the reducer itself never reads a clock.
Union Members
Type Literal
{
deviceId: string;
type: "start";
}
Command: the app asked to cast to a device.
Type Literal
{
at: number;
transferBack: boolean;
type: "end";
}
Command: the app asked to end the session.
Type Literal
{
at: number;
snapshot: CastHandoffQueueSnapshot;
type: "resync";
}
Command: the JS queue changed while casting — re-project it.
Type Literal
{
at: number;
snapshot: CastHandoffQueueSnapshot;
type: "sessionStarted";
}
A cast session is up (requestSession resolved, or the system switcher/picker did it).
Type Literal
{
error: CastError;
type: "sessionStartFailed";
}
Type Literal
{
at: number;
type: "sessionEnded";
}
Type Literal
{
at: number;
type: "sessionSuspended";
}
Type Literal
{
at: number;
itemIds: readonly number[];
type: "castQueueLoaded";
}
loadCastQueue completed; itemIds are the receiver-assigned ids in queue order.
Type Literal
{
at: number;
itemIds: readonly number[];
type: "queueItemIds";
}
A fresh read of the receiver item ids, outside a load ack. Device truth
behind this event: the sender-side MediaQueue mirror populates
asynchronously after queueLoad's command ack, so the ids fetched with
the ack are routinely empty — the orchestrator re-reads them on every
native queueChanged and feeds them in here, which is what heals the
reconciliation mapping. (Found on hardware: every receiver jump rejected
invalid-argument until this existed.)
Type Literal
{
error: CastError;
type: "castQueueLoadFailed";
}
Type Literal
{
at: number;
status: NativeCastMediaStatusEvent;
type: "mediaStatus";
}
A receiver status discontinuity.
Type Literal
{
error: CastError;
type: "castError";
}
A typed cast error (receiver fetch failure and friends).
Type Literal
{
type: "localRestored";
}
restoreLocal completed.
Type Literal
{
error: CastError;
type: "localRestoreFailed";
}