Class: shaka.cast.CastReceiver

Constructor

new CastReceiver(videonon-null, playernon-null, appDataCallbackopt, contentIdCallback)

Parameters:
Name Type Attributes Description
video HTMLMediaElement The local video element associated with the local Player instance.
player shaka.Player A local Player instance.
appDataCallback function <optional>
A callback to handle application-specific data passed from the sender. This can come either from a Shaka-based sender through CastProxy.setAppData, or from a sender using the customData field of the LOAD message of the standard Cast message namespace. It can also be null if no such data is sent.
contentIdCallback function A callback to retrieve manifest URI from the provided content id.
Implements:
Source:

Members

IDLE_INTERVAL :number

The interval, in seconds, to go "idle".
Type:
  • number
Source:

PLAY_STATE :string

Type:
  • string
Properties:
Name Value Type Description
IDLE IDLE string
PLAYING PLAYING string
BUFFERING BUFFERING string
PAUSED PAUSED string
Source:

POLL_INTERVAL :number

The interval, in seconds, to poll for changes.
Type:
  • number
Source:

appDataCallback_ :?function(Object)

Type:
  • ?function(Object)
Source:

contentIdCallback_ :?function(string):string

Type:
  • ?function(string):string
Source:

genericBus_ :cast.receiver.CastMessageBus

Type:
  • cast.receiver.CastMessageBus
Source:

initialStatusUpdatePending_ :boolean

Type:
  • boolean
Source:

isConnected_ :boolean

Type:
  • boolean
Source:

isIdle_ :boolean

Type:
  • boolean
Source:

metadata_ :Object

A Cast metadata object, one of: - https://developers.google.com/cast/docs/reference/messages#GenericMediaMetadata - https://developers.google.com/cast/docs/reference/messages#MovieMediaMetadata - https://developers.google.com/cast/docs/reference/messages#TvShowMediaMetadata - https://developers.google.com/cast/docs/reference/messages#MusicTrackMediaMetadata
Type:
  • Object
Source:

shakaBus_ :cast.receiver.CastMessageBus

Type:
  • cast.receiver.CastMessageBus
Source:

startUpdatingUpdateNumber_ :boolean

Type:
  • boolean
Source:

targets_ :Object

Type:
  • Object
Source:

updateNumber_ :number

Type:
  • number
Source:

Methods

clearContentMetadata()

Clear all Cast content metadata. Should be called from an appDataCallback.
Source:

destroy() → {Promise}

Destroys the underlying Player, then terminates the cast receiver app.
Implements:
Source:
Returns:
Type
Promise

fakeVolumeChangeEvent_()

Dispatch a fake 'volumechange' event to mimic the video element, since volume changes are routed to the system volume on the receiver.
Source:

getPlayState_() → {string}

Source:
Returns:
Type
string

initState_(initState, appData)

Take on initial state from the sender.
Parameters:
Name Type Description
initState shaka.cast.CastUtils.InitStateType
appData Object
Source:

isConnected() → {boolean}

Source:
Returns:
True if the cast API is available and there are receivers.
Type
boolean

isIdle() → {boolean}

Source:
Returns:
True if the receiver is not currently doing loading or playing anything.
Type
boolean

maybeSendMediaInfoMessage_() → {boolean}

Composes and sends a mediaStatus message if appropriate.
Source:
Returns:
Type
boolean

onCastStatusChanged_()

Dispatch an event to notify the receiver app that the status has changed.
Source:

onGenericMessage_(eventnon-null)

Parameters:
Name Type Description
event cast.receiver.CastMessageBus.Event
Source:

onSendersChanged_()

Source:

onShakaMessage_(eventnon-null)

Since this method is in the compiled library, make sure all messages are read with quoted properties.
Parameters:
Name Type Description
event cast.receiver.CastMessageBus.Event
Source:

pollAttributes_()

Source:

proxyEvent_(targetName, eventnon-null)

Parameters:
Name Type Description
targetName string
event Event
Source:

sendAsyncComplete_(senderId, id, error)

Tell the sender that the async operation is complete.
Parameters:
Name Type Description
senderId string
id string
error shaka.util.Error
Source:

sendMediaInfoMessage_(requestIdopt)

Composes and sends a mediaStatus message with a mediaInfo component.
Parameters:
Name Type Attributes Default Description
requestId number <optional>
0
Source:

sendMediaStatus_(requestIdopt, mediaopt)

Parameters:
Name Type Attributes Default Description
requestId number <optional>
0
media Object <optional>
null
Source:

sendMessage_(messagenon-null, bus, senderIdopt)

Since this method is in the compiled library, make sure all messages passed in here were created with quoted property names.
Parameters:
Name Type Attributes Description
message Object
bus cast.receiver.CastMessageBus
senderId string <optional>
Source:

setContentArtist(artist)

Set the Cast content's artist. Also sets the metadata type to music. Should be called from an appDataCallback.
Parameters:
Name Type Description
artist string
Source:

setContentImage(imageUrl)

Set the Cast content's thumbnail image. Should be called from an appDataCallback.
Parameters:
Name Type Description
imageUrl string
Source:

setContentMetadata(metadata)

Set all Cast content metadata, as defined by the Cast SDK. Should be called from an appDataCallback. For a simpler way to set basic metadata, see: - setContentTitle() - setContentImage() - setContentArtist()
Parameters:
Name Type Description
metadata Object A Cast metadata object, one of: - https://developers.google.com/cast/docs/reference/messages#GenericMediaMetadata - https://developers.google.com/cast/docs/reference/messages#MovieMediaMetadata - https://developers.google.com/cast/docs/reference/messages#TvShowMediaMetadata - https://developers.google.com/cast/docs/reference/messages#MusicTrackMediaMetadata
Source:

setContentTitle(title)

Set the Cast content's title. Should be called from an appDataCallback.
Parameters:
Name Type Description
title string
Source: