Skip to main content

Class: CastSender

CastSender handles initiation of and communication with the Google Cast Receiver

Extends

Accessors

casting

Get Signature

get casting(): boolean

True if the instance is casting right now

Returns

boolean


channelId

Get Signature

get channelId(): string

The current channelId

Returns

string

Set Signature

set channelId(channelId): void

Set the current channelId

Parameters

channelId: string

Returns

void


language

Get Signature

get language(): undefined | string

The current language

Returns

undefined | string

Set Signature

set language(language): void

Set the current language

Parameters

language: undefined | string

Returns

void


volume

Get Signature

get volume(): number

The current volume

Returns

number

Set Signature

set volume(volume): void

Set the current volume. Setting this to zero is equivalent to muting the video

Parameters

volume: number

Returns

void

Methods

getReceiverName()

getReceiverName(): undefined | string

Returns a string representing the name of the Cast receiver device or undefined if no receiver exists

Returns

undefined | string


init()

init(): Promise<void>

Initiates the CastSender. Will reject if Cast is not available on the device or the network.

Returns

Promise<void>


on()

on<T>(eventName, fn): void

Add an event listener to eventName

Event listeners may optionally return a "defer function" that will be called once all other listeners have been called. This is useful when one listener may want everone to have reacted to an event before calling something.

Type Parameters

T extends "connected" | "resumed" | "disconnected" | "failed"

Parameters

eventName: T

fn

Returns

void

Inherited from

Emitter.on


once()

once<T>(eventName, fn): void

Add an event listener to eventName that will be called once only

Event listeners may optionally return a "defer function" that will be called once all other listeners have been called. This is useful when one listener may want everone to have reacted to an event before calling something.

Type Parameters

T extends "connected" | "resumed" | "disconnected" | "failed"

Parameters

eventName: T

fn

Returns

void

Inherited from

Emitter.once


start()

start(): Promise<void>

Requests a session. It will open the native cast receiver chooser dialog

Returns

Promise<void>


stop()

stop(): void

Stops a session. It will stop playback on device as well.

Returns

void


unload()

unload(): void

Fully unloads the instance. This disconnects the current listener but lets the cast session continue on the receiving device

Returns

void


updateAuthenticationToken()

updateAuthenticationToken(token): void

Update authentication token on an already established and authenticated connection

Parameters

token: string

Returns

void