Constructor
new CastProxy(videonon-null, playernon-null, receiverAppId, androidReceiverCompatible)
A proxy to switch between local and remote playback for Chromecast in a way that is transparent to the app's controls.
Parameters:
| Name | Type | Default | Description | 
|---|---|---|---|
video | 
            
            HTMLMediaElement | The local video element associated with the local Player instance. | |
player | 
            
            shaka.Player | A local Player instance. | |
receiverAppId | 
            
            string | The ID of the cast receiver application. If blank, casting will not be available, but the proxy will still function otherwise. | |
androidReceiverCompatible | 
            
            boolean | false | Indicates if the app is compatible with an Android Receiver. | 
- Implements:
 - Source:
 
Members
Methods
canCast() → {boolean}
- Source:
 
Returns:
    True if the cast API is available and there are
  receivers.
- Type
 - boolean
 
cast() → {Promise}
- Source:
 
Returns:
    Resolved when connected to a receiver.  Rejected if the
  connection fails or is canceled by the user.
- Type
 - Promise
 
changeReceiverId(newAppId, newCastAndroidReceiveropt)
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
newAppId | 
            
            string | |||
newCastAndroidReceiver | 
            
            boolean | 
                
                    <optional> | 
            
            
                false | 
- Source:
 
destroy(forceDisconnectopt) → {Promise}
    Destroys the proxy and the underlying local Player.
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
forceDisconnect | 
            
            boolean | 
                
                    <optional> | 
            
            
            If true, force the receiver app to shut down by disconnecting. Does nothing if not connected. | 
- Implements:
 - Source:
 
Returns:
- Type
 - Promise
 
forceDisconnect()
    Force the receiver app to shut down by disconnecting.
- Source:
 
getInitState_() → {shaka.cast.CastUtils.InitStateType}
- Source:
 
Returns:
    initState Video and player
  state to be sent to the receiver.
    
getPlayer() → {shaka.Player}
    Get a proxy for the Player that delegates to local and remote Player
objects as appropriate.
- Source:
 
Returns:
- Type
 - shaka.Player
 
getVideo() → {HTMLMediaElement}
    Get a proxy for the video element that delegates to local and remote video
elements as appropriate.
- Source:
 
Returns:
- Type
 - HTMLMediaElement
 
initWithoutSender_()
    Initialize the Proxies without Cast sender.
- Source:
 
isCasting() → {boolean}
- Source:
 
Returns:
    True if we are currently casting.
- Type
 - boolean
 
iterateOverPlayerMethods_(operation)
    Iterates over all of the methods of the player, including inherited methods
from FakeEventTarget.
    Parameters:
| Name | Type | Description | 
|---|---|---|
operation | 
            
            function(string, function()) | 
- Source:
 
mapCompiledToUncompiledPlayerMethodNames_()
    Maps compiled to uncompiled player names so we can figure out
which method to call in compiled build, while casting.
- Source:
 
onCastStatusChanged_()
    Dispatch an event to notify the app that the status has changed.
- Source:
 
onFirstCastStateUpdate_()
    Dispatch a synthetic play or pause event to ensure that the app correctly
knows that the player is playing, if joining an existing receiver.
- Source:
 
onRemoteEvent_(targetName, eventnon-null)
Parameters:
| Name | Type | Description | 
|---|---|---|
targetName | 
            
            string | |
event | 
            
            shaka.util.FakeEvent | 
- Source:
 
onResumeLocal_()
    Transfer remote state back and resume local playback.
- Source:
 
playerProxyGet_(name) → {?}
Parameters:
| Name | Type | Description | 
|---|---|---|
name | 
            
            string | 
- Source:
 
Returns:
- Type
 - ?
 
playerProxyLocalEvent_(eventnon-null)
Parameters:
| Name | Type | Description | 
|---|---|---|
event | 
            
            Event | 
- Source:
 
receiverName() → {string}
- Source:
 
Returns:
    The name of the Cast receiver device, if isCasting().
- Type
 - string
 
setAppData(appData)
    Set application-specific data.
    Parameters:
| Name | Type | Description | 
|---|---|---|
appData | 
            
            Object | Application-specific data to relay to the receiver. | 
- Source:
 
suggestDisconnect()
    Show a dialog where user can choose to disconnect from the cast connection.
- Source:
 
videoProxyGet_(name) → {?}
Parameters:
| Name | Type | Description | 
|---|---|---|
name | 
            
            string | 
- Source:
 
Returns:
- Type
 - ?
 
videoProxyLocalEvent_(eventnon-null)
Parameters:
| Name | Type | Description | 
|---|---|---|
event | 
            
            Event | 
- Source:
 
videoProxySet_(name, value)
Parameters:
| Name | Type | Description | 
|---|---|---|
name | 
            
            string | |
value | 
            
            ? | 
- Source:
 
Events
CastStatusChangedEvent
    Fired when cast status changes.  The status change will be
  reflected in canCast() and isCasting().
    Properties:
| Name | Type | Description | 
|---|---|---|
type | 
            
            
            string | 'caststatuschanged' | 
- Source: