Class: CastSender
CastSender handles initiation of and communication with the Google Cast Receiver
Extends
Emitter<CastSenderEvents>
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():
string|undefined
The current language
Returns
string | undefined
Set Signature
set language(
language):void
Set the current language
Parameters
language
string | undefined
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():
string|undefined
Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
Returns
string | undefined
hasListeners()
hasListeners<
T>(eventName):boolean
Check whether there are any listeners registered for the given event.
Type Parameters
T
T extends keyof CastSenderEvents
Parameters
eventName
T
Returns
boolean
Inherited from
Emitter.hasListeners
init()
init():
Promise<void>
Initiates the CastSender. Will reject if Cast is not available on the device or the network.
Returns
Promise<void>
off()
Call Signature
off<
T>(eventName,fn):void
Remove an event listener from eventName
Type Parameters
T
T extends "connected" | "resumed" | "disconnected" | "failed"
Parameters
eventName
T
fn
() => EventListenerReturnType
Returns
void
Inherited from
Emitter.off
Call Signature
off<
T>(eventName,fn):void
Remove an event listener from eventName
Type Parameters
T
T extends "metadata" | "server wallclock time"
Parameters
eventName
T
fn
(args) => EventListenerReturnType
Returns
void
Inherited from
Emitter.off
on()
Call Signature
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
T extends "connected" | "resumed" | "disconnected" | "failed"
Parameters
eventName
T
fn
() => void
Returns
void
Inherited from
Emitter.on
Call Signature
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
T extends "metadata" | "server wallclock time"
Parameters
eventName
T
fn
(args) => void
Returns
void
Inherited from
Emitter.on
once()
Call Signature
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
T extends "connected" | "resumed" | "disconnected" | "failed"
Parameters
eventName
T
fn
() => void
Returns
void
Inherited from
Emitter.once
Call Signature
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
T extends "metadata" | "server wallclock time"
Parameters
eventName
T
fn
(args) => void
Returns
void
Inherited from
Emitter.once
reset()
reset():
void
Reset the event emitter
Returns
void
Inherited from
Emitter.reset
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