Class: shaka.cast.CastReceiver

Constructor

new CastReceiver(videonon-null, playernon-null, opt_appDataCallbackopt, opt_contentIdCallback)

A receiver to communicate between the Chromecast-hosted player and the sender application.
Parameters:
Name Type Attributes Description
video HTMLMediaElement The local video element associated with the local Player instance.
player shaka.Player A local Player instance.
opt_appDataCallback function(Object)= <optional>
A callback to handle application-specific data passed from the sender.
opt_contentIdCallback function(string): string= A callback to retrieve manifest URI from the provided content id.
Implements:
Extends:
Source:

Members

(static) PLAY_STATE :string

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

(private, nullable) appDataCallback_ :?function(Object)

Type:
  • ?function(Object)
Source:

dispatchTarget :EventTarget

The target of all dispatched events. Defaults to |this|.
Type:
  • EventTarget
Inherited From:
Source:

(private) genericBus_ :cast.receiver.CastMessageBus

Type:
  • cast.receiver.CastMessageBus
Source:

(private) isConnected_ :boolean

Type:
  • boolean
Source:

(private) isIdle_ :boolean

Type:
  • boolean
Source:

(private, non-null) listeners_ :shaka.util.MultiMap.<shaka.util.FakeEventTarget.ListenerType>

Type:
Inherited From:
Source:

(private, nullable) opt_contentIdCallback_ :?function(string): string

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

(private) player_ :shaka.Player

Type:
Source:

(private, nullable) pollTimerId_ :number

Type:
  • number
Source:

(private) shakaBus_ :cast.receiver.CastMessageBus

Type:
  • cast.receiver.CastMessageBus
Source:

(private) startUpdatingUpdateNumber_ :boolean

Type:
  • boolean
Source:

(private) targets_ :Object

Type:
  • Object
Source:

(private) updateNumber_ :number

Type:
  • number
Source:

(private) video_ :HTMLMediaElement

Type:
  • HTMLMediaElement
Source:

Methods

addEventListener(type, listener, opt_optionsopt)

Add an event listener to this object.
Parameters:
Name Type Attributes Description
type string The event type to listen for.
listener shaka.util.FakeEventTarget.ListenerType The callback or listener object to invoke.
opt_options AddEventListenerOptions | boolean <optional>
Ignored.
Inherited From:
Source:

destroy() → (non-null) {Promise}

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

dispatchEvent(eventnon-null) → {boolean}

Dispatch an event from this object.
Parameters:
Name Type Description
event Event The event to be dispatched from this object.
Inherited From:
Source:
Returns:
True if the default action was prevented.
Type
boolean

(private) fakeVolumeChangeEvent_()

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

(private) getPlayState_() → {string}

Source:
Returns:
Type
string

(private) init_()

Source:

(private) 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

(private) onCastStatusChanged_()

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

(private) onGenericMessage_(eventnon-null)

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

(private) onSendersChanged_()

Source:

(private) 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:

(private) pollAttributes_()

Source:

(private) proxyEvent_(targetName, eventnon-null)

Parameters:
Name Type Description
targetName string
event Event
Source:

removeEventListener(type, listener, opt_optionsopt)

Remove an event listener from this object.
Parameters:
Name Type Attributes Description
type string The event type for which you wish to remove a listener.
listener shaka.util.FakeEventTarget.ListenerType The callback or listener object to remove.
opt_options EventListenerOptions | boolean <optional>
Ignored.
Inherited From:
Source:

(private) 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:

(private) sendMediaStatus_(requestId, opt_mediaopt)

Parameters:
Name Type Attributes Description
requestId number
opt_media Object <optional>
Source:

(private) sendMessage_(messagenon-null, bus, opt_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
opt_senderId string <optional>
Source: