Describes the state of a currently running Cast application. Normally, these objects should not be created by the client.
| Class summary | |
|---|---|
|
chrome.cast.Session(sessionId, appId, displayName, appImages, receiver)
Describes the state of a currently running Cast application.
Normally, these objects should not be created by the client.
|
|
| Properties summary | |
|---|---|
| string |
The identifer of the Cast application.
|
| chrome.cast.Image[] must not be null |
Array of images available describing the application.
|
| string |
The human-readable name of the Cast application, for example, "YouTube".
|
| chrome.cast.media.Media[] must not be null |
The media that belong to this Cast session, including those
loaded by other senders.
|
| {name: string}[] must not be null |
A list of the namespaces supported by the receiver application.
|
| chrome.cast.Receiver must not be null |
The receiver that is running the application.
|
| chrome.cast.SenderApplication[] must not be null |
The sender applications supported by the receiver application.
|
| string |
Uniquely identifies this instance of the receiver application.
|
| chrome.cast.SessionStatus must not be null |
Status of this Cast session to the receiver application.
|
| string or null |
Descriptive text for the current application content, for example “My
Wedding Slideshow”.
|
| Methods summary | |
|---|---|
| void |
setReceiverVolumeLevel(newLevel, successCallback, errorCallback)
Sets the receiver volume.
|
| void |
setReceiverMuted(muted, successCallback, errorCallback)
Sets the receiver volume.
|
| void |
leave(successCallback, errorCallback)
Leaves (disconnects) from the running receiver application associated with
the session.
|
| void |
stop(successCallback, errorCallback)
Stops the running receiver application associated with the session.
|
| void |
sendMessage(namespace, message, successCallback, errorCallback)
Sends a message to the receiver application on the given namespace.
|
| void |
addUpdateListener(listener)
Adds a listener that is invoked when the Session has changed.
|
| void |
removeUpdateListener(listener)
Removes a previously added listener for this Session.
|
| void |
addMessageListener(namespace, listener)
Adds a listener that is invoked when a message is received from the receiver
application.
|
| void |
removeMessageListener(namespace, listener)
Removes a previously added listener for messages.
|
| void |
addMediaListener(listener)
Adds a listener that is invoked when a media session is created by
another sender.
|
| void |
removeMediaListener(listener)
Removes a listener that was previously added with addMediaListener.
|
| void |
loadMedia(loadRequest, successCallback, errorCallback)
Loads media into a running receiver application.
|
Class details
- Parameters:
- string sessionId
- The session identifier.
- string appId
- The receiver application identifier.
- string displayName
- The display name of the application.
- Array of chrome.cast.Image appImages
- Images associated with the app. Must not be null.
- chrome.cast.Receiver receiver
- The receiver that is running the app. Must not be null.
Property details
The identifer of the Cast application. Not for display.
The human-readable name of the Cast application, for example, "YouTube".
The media that belong to this Cast session, including those loaded by other senders.
Must not be null.
A list of the namespaces supported by the receiver application.
Must not be null.
The sender applications supported by the receiver application. This may be used to prompt the user to install or visit the sender application.
Must not be null.
Uniquely identifies this instance of the receiver application.
Status of this Cast session to the receiver application.
Must not be null.
Descriptive text for the current application content, for example “My Wedding Slideshow”.
May be null.
Method details
- Parameters:
- number newLevel
- The new volume level between 0.0 and 1.0.
- function() successCallback
- function(chrome.cast.Error) errorCallback
- The possible errors are TIMEOUT, API_NOT_INITIALIZED, INVALID_PARAMETER, CHANNEL_ERROR, SESSION_ERROR, and EXTENSION_MISSING.
- Parameters:
- boolean muted
- The new muted status.
- function() successCallback
- function(chrome.cast.Error) errorCallback
- The possible errors are TIMEOUT, API_NOT_INITIALIZED, INVALID_PARAMETER, CHANNEL_ERROR, SESSION_ERROR, and EXTENSION_MISSING.
Existing clients within the scope defined by this client's AutoJoinPolicy will be disconnected. Future clients will not automatically join the session that was left.
All disconnected clients will have their session update listeners called
with isAlive = true. Listeners should check the
status property of the Session to determine its connection
status since isAlive is deprecated. In this case,
status = chrome.cast.SessionStatus.DISCONNECTED.
- Parameters:
- function() successCallback
- function(chrome.cast.Error) errorCallback
- The possible errors are TIMEOUT, API_NOT_INITIALIZED, CHANNEL_ERROR, SESSION_ERROR, and EXTENSION_MISSING.
- Parameters:
- function() successCallback
- function(chrome.cast.Error) errorCallback
- The possible errors are TIMEOUT, API_NOT_INITIALIZED, CHANNEL_ERROR, SESSION_ERROR, and EXTENSION_MISSING.
- Parameters:
- string namespace
- The namespace to send the message on, e.g. 'urn:x-cast:com.example.namespace'.
- Object or string message
- Must not be null.
- function() successCallback
- Invoked when the message has been sent. Must not be null.
- function(chrome.cast.Error) errorCallback
- Invoked on error. The possible errors are TIMEOUT, API_NOT_INITIALIZED, INVALID_PARAMETER, CHANNEL_ERROR, SESSION_ERROR, and EXTENSION_MISSING.
Listeners should check the status property of the Session to
determine its connection status. The boolean parameter isAlive
is deprecated in favor of the status Session property. The
isAlive parameter is still passed in for backwards
compatibility, and is true unless
status = chrome.cast.SessionStatus.STOPPED.
- Parameters:
- function(boolean) listener
- The listener to add.
- Parameters:
- function(boolean) listener
- The listener to remove.
- Parameters:
- string namespace
- The namespace to listen on, e.g. 'urn:x-cast:com.example.namespace'.
- function(string,string) listener
- The listener to add.
- Parameters:
- string namespace
- The namespace that is listened to, e.g. 'urn:x-cast:com.example.namespace'.
- function(string,string) listener
- The listener to remove.
- Parameters:
- function(chrome.cast.media.Media) listener
- The listener to add.
- Parameters:
- function(chrome.cast.media.Media) listener
- The listener to remove.
- Parameters:
- chrome.cast.media.LoadRequest loadRequest
- Request to load media. Must not be null.
- function(chrome.cast.media.Media) successCallback
- Invoked with the loaded Media on success.
- function(chrome.cast.Error) errorCallback
- Invoked on error. The possible errors are TIMEOUT, API_NOT_INITIALIZED, INVALID_PARAMETER, CHANNEL_ERROR, SESSION_ERROR, and EXTENSION_MISSING.