Constructor
(export) new CastReceiver(videonon-null, playernon-null, appDataCallbackopt, 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. | |
appDataCallback |
function(Object)= |
<optional> |
A callback to handle application-specific data passed from the sender. |
contentIdCallback |
function(string):string= | A callback to retrieve manifest URI from the provided content id. |
- Implements:
- Extends:
- Source:
Extends
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:
(private, nullable) contentIdCallback_ :?function(string):string
Type:
- ?function(string):string
- 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) initialStatusUpdatePending_ :boolean
Type:
- boolean
- Source:
(private, non-null) listeners_ :shaka.util.MultiMap.<shaka.util.FakeEventTarget.ListenerType>
Type:
- Inherited From:
- Source:
(private) shakaBus_ :cast.receiver.CastMessageBus
Type:
- cast.receiver.CastMessageBus
- Source:
(private) startUpdatingUpdateNumber_ :boolean
Type:
- boolean
- Source:
Methods
(export) addEventListener(type, listener, 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. | |
options |
AddEventListenerOptions | boolean |
<optional> |
Ignored. |
- Inherited From:
- Source:
(export) destroy() → (non-null) {Promise}
Destroys the underlying Player, then terminates the cast receiver app.
- Implements:
- Source:
Returns:
- Type
- Promise
(export) 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:
(export) isConnected() → {boolean}
- Source:
Returns:
True if the cast API is available and there are receivers.
- Type
- boolean
(export) isIdle() → {boolean}
- Source:
Returns:
True if the receiver is not currently doing loading or
playing anything.
- Type
- boolean
(private) maybeSendMediaInfoMessage_() → {boolean}
Composes and sends a mediaStatus message if appropriate.
- Source:
Returns:
- 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:
(export) removeEventListener(type, listener, 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. | |
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) sendMediaInfoMessage_()
Composes and sends a mediaStatus message with a mediaInfo component.
- Source:
(private) sendMediaStatus_(requestId, mediaopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
requestId |
number | ||
media |
Object |
<optional> |
- Source:
(private) 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: