Hide

Google Cast Chrome Sender API Reference

chrome.cast.VERSION

The API version.

chrome.cast.timeout

Default timeout values in milliseconds for API methods.

chrome.cast.ReceiverActionListener

chrome.cast.isAvailable

Flag for clients to check whether the API is loaded.

chrome.cast.initialize

static void chrome.cast.initialize(apiConfig, successCallback, errorCallback)
Initializes the API. Note that either successCallback and errorCallback will be invoked once the API has finished initialization. The sessionListener and receiverListener may be invoked at any time afterwards, and possibly more than once.
Parameters:
chrome.cast.ApiConfig apiConfig
The object with parameters to initialize the API. Must not be null.
function() successCallback
function(chrome.cast.Error) errorCallback
The possible errors are TIMEOUT, INVALID_PARAMETER, EXTENSION_MISSING.

chrome.cast.requestSession

static void chrome.cast.requestSession(successCallback, errorCallback, opt_sessionRequest)
Requests that a receiver application session be created or joined. By default, the SessionRequest passed to the API at initialization time is used; this may be overridden by passing a different session request in opt_sessionRequest.
Parameters:
function(chrome.cast.Session) successCallback
function(chrome.cast.Error) errorCallback
The possible errors are TIMEOUT, INVALID_PARAMETER, API_NOT_INITIALIZED, CANCEL, CHANNEL_ERROR, SESSION_ERROR, RECEIVER_UNAVAILABLE, and EXTENSION_MISSING. Note that the timeout timer starts after users select a receiver. Selecting a receiver requires user's action, which has no timeout.
chrome.cast.SessionRequest opt_sessionRequest
Optional.

chrome.cast.requestSessionById

static void chrome.cast.requestSessionById(sessionId)
Requests to join an existing session with the given id. Once joined, the session will be passed to the sessionListener set by chrome.cast.initialize. If the session with the given sessionId is already known when this function is called, then sessionListener is called immediately. Otherwise, once a session with the given sessionId is discovered, sessionListener will be called.
Parameters:
string sessionId
The id of the session to join.

chrome.cast.addReceiverActionListener

static void chrome.cast.addReceiverActionListener(listener)
Adds a listener function that will be invoked when the user has acted through the UI to start or stop casting. The sender application can use this to show a transition in its user interface (i.e., pause locally playing media) before the casting action has completed or failed.
  • The listener is not guaranteed to be invoked and applications should not rely on it to function correctly.
  • The listener will be passed the receiver that was acted upon, if available. However the receiver may not be known and null will be passed instead.
  • The listener will be called as soon as possible after the user has acted. It should be invoked before the application is notified of the resulting state change through the API.
Parameters:
chrome.cast.ReceiverActionListener listener
The listener function to add. The first argument to the listener is the receiver that was acted on. The second argument to the listener is the action that was requested (see chrome.cast.ReceiverAction).

chrome.cast.removeReceiverActionListener

static void chrome.cast.removeReceiverActionListener(listener)
Removes a listener function that was previously added with addReceiverActionListener.
Parameters:
chrome.cast.ReceiverActionListener listener
The listener function to remove.

chrome.cast.logMessage

static void chrome.cast.logMessage(message)
Logs a debug message from the app. This message may be sent in a feedback report to Google if users explicitly choose to include fine logs.
Parameters:
string message
The message to log.

chrome.cast.setCustomReceivers

static void chrome.cast.setCustomReceivers(receivers, successCallback, errorCallback)
Sets custom receiver list
Parameters:
Array of chrome.cast.Receiver receivers
The new list. Must not be null.
function() successCallback
function(chrome.cast.Error) errorCallback
The possible errors are TIMEOUT, API_NOT_INITIALIZED, INVALID_PARAMETER, CHANNEL_ERROR, and EXTENSION_MISSRING.

chrome.cast.setReceiverDisplayStatus

static void chrome.cast.setReceiverDisplayStatus(receiver, successCallback, errorCallback)
Sets the receiver name and display status. To show the receiver as idle, set displayStatus to null. Only valid for CUSTOM receivers. The receiver's displayStatus is ignored if this receiver is CAST; Cast receiver status is updated by the receiver application.
Parameters:
chrome.cast.Receiver receiver
The receiver. Must not be null.
function() successCallback
Callback when setting status succeeds.
function(chrome.cast.Error) errorCallback
The possible errors are TIMEOUT, INVALID_PARAMETER, API_NOT_INITIALIZED, and EXTENSION_MISSING.
Holds the configuraton for the API when initialized.
Properties
Auto-join policy determines when the SDK will automatically connect a sender application to an existing session after API initialization.
Values
Capabilities that are supported by the receiver device.
Values
Default action policy determines when the SDK will automatically create a session after initializing the API.
Values
Describes an error returned by the API.
Properties
Errors that may be returned by the SDK.
Values
An image that describes a receiver application or media item.
Properties
A request to modify the text tracks style or change the tracks status.
Properties
A generic media description.
Properties
A request to get the media status.
Properties
Possible reason why a media is idle.
Values
A request to load new media into the player.
Properties
Represents a media item that has been loaded into the receiver application.
Functions
Properties
Possible media commands supported by the receiver application.
Values
Describes a media item.
Properties
Possible types of media metadata.
Values
A movie media description.
Properties
A music track media description.
Properties
A request to pause the currently playing media.
Properties
A photo media description.
Properties
Possible states of the media player.
Values
A request to play the currently paused media.
Properties
States of the media player after resuming.
Values
A request to seek the current media.
Properties
A request to stop the media player.
Properties
Possible media stream types.
Values
Possible text track edge types.
Values
Possible text track font generic family.
Values
Possible text track font style.
Values
Describes style information for a text track.
Properties
Possible text track types.
Values
Possible text track window types.
Values
Default timeout values in milliseconds for media API methods.
Properties
Describes track metadata information.
Properties
Possible media track types.
Values
A TV episode media description.
Properties
A request to set the stream volume of the playing media.
Properties
Describes the receiver running an application.
Properties
Actions that the user can take on a receiver in the extension.
Values
Describes availability of a Cast receiver.
Values
Receiver status shown to the user in the extension UI.
Properties
Values
Describes a sender application.
Properties
Describes a sender application platform.
Values
Describes the state of a currently running Cast application.
Functions
Properties
A request to start or connect to a session.
Properties
Describes status of a Cast session to its receiver application.
Values
Default timeout values in milliseconds for API methods.
Properties
The volume of a device or media stream.
Properties

Index of all classes and functions