Class: shaka.cast.CastReceiver

Constructor

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

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.
Implements:
Extends:
Source:

Members

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

Type:
  • ?function(Object)
Source:

(private) bus_ :cast.receiver.CastMessageBus

Type:
  • cast.receiver.CastMessageBus
Source:

dispatchTarget :EventTarget

The target of all dispatched events. Defaults to |this|.
Type:
  • EventTarget
Inherited From:
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) player_ :shaka.Player

Type:
Source:

(private, nullable) pollTimerId_ :number

Type:
  • number
Source:

(private) targets_ :Object

Type:
  • Object
Source:

(private) video_ :HTMLMediaElement

Type:
  • HTMLMediaElement
Source:

Methods

addEventListener(type, listener, opt_capturingopt)

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_capturing boolean <optional>
Ignored. FakeEventTargets do not have parents, so events neither capture nor bubble.
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) 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) onMessage_(event)

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

Source:

(private) pollAttributes_()

Source:

(private) proxyEvent_(targetName, eventnon-null)

Parameters:
Name Type Description
targetName string
event Event
Source:

removeEventListener(type, listener, opt_capturingopt)

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_capturing boolean <optional>
Ignored. FakeEventTargets do not have parents, so events neither capture nor bubble.
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) sendMessage_(messagenon-null, 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
opt_senderId string <optional>
Source: