Class: CastSender
CastSender handles initiation of and communication with the Google Cast Receiver
Hierarchy
-
Emitter
<CastSenderEvents
>↳
CastSender
Accessors
casting
• get
casting(): boolean
True if the instance is casting right now
Returns
boolean
channelId
• get
channelId(): string
The current channelId
Returns
string
• set
channelId(channelId
): void
Set the current channelId
Parameters
Name | Type |
---|---|
channelId | string |
Returns
void
language
• get
language(): undefined
| string
The current language
Returns
undefined
| string
• set
language(language
): void
Set the current language
Parameters
Name | Type |
---|---|
language | undefined | string |
Returns
void
volume
• get
volume(): number
The current volume
Returns
number
• set
volume(volume
): void
Set the current volume. Setting this to zero is equivalent to muting the video
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
T | extends "connected" | "resumed" | "disconnected" | "failed" |
Parameters
Name | Type |
---|---|
eventName | T |
fn | () => void |
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
Name | Type |
---|---|
T | extends "connected" | "resumed" | "disconnected" | "failed" |
Parameters
Name | Type |
---|---|
eventName | T |
fn | () => void |
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
Name | Type |
---|---|
token | string |
Returns
void