Skip to main content

Function: canCastMedia()

function canCastMedia(item: CanCastInput): CanCastVerdict;

Defined in: packages/cast/src/can-cast.ts:120

Can this item be handed to a Cast receiver?

Decision order (most fundamental first):

  1. local-file — non-HTTP(S) sources can never cast; nothing else matters.
  2. headers — the receiver fetches without them, so the fetch would 401.
  3. codec — MIME type when supplied, else the URL extension, against the receiver table. An extension we cannot classify (or no extension at all — live streams, signed URLs) is reported castable: this heuristic only denies what the table denies, and the cast-receiver-fetch error family catches the receiver's own verdict at load time.

Ceilings the URL cannot reveal (documented, not detected): FLAC above 96 kHz/24-bit; ALAC inside a .m4a (the extension says AAC).

Parameters

ParameterType
itemCanCastInput

Returns

CanCastVerdict