Interface Chromecast

The Chromecast API.

interface Chromecast {
    casting: boolean;
    connectionCallback: undefined | ChromecastConnectionCallback;
    error: undefined | ChromecastError;
    receiverName: undefined | string;
    source: undefined | SourceDescription;
    state: CastState;
    addEventListener<TType>(type: TType | readonly TType[], listener: EventListener<ChromecastEventMap[TType]>): void;
    join(): void;
    leave(): void;
    removeEventListener<TType>(type: TType | readonly TType[], listener: EventListener<ChromecastEventMap[TType]>): void;
    start(): void;
    stop(): void;
}

Hierarchy (view full)

Properties

casting: boolean

Whether the player is casting.

connectionCallback: undefined | ChromecastConnectionCallback

The callback for the Chromecast connection changes.

error: undefined | ChromecastError

The last error that occurred during casting, if any.

receiverName: undefined | string

The name of the Chromecast device that the player is casting to, if any.

source: undefined | SourceDescription

The source of the active casting session, if any.

Superseded by Chromecast.connectionCallback.

state: CastState

The state of the casting process.

Methods

  • Join an active casting session.

    Returns void

  • Leave the active casting session.

    Returns void


    - Does not stop the session when other devices are connected.
    - Use VendorCast.stop to fully stop the session.

  • Start a casting session with the player's source.

    Returns void


    - A native browser pop-up will prompt to choose a casting target device.

  • Stop the active casting session.

    Returns void