Constructor

ApiConfig

new ApiConfig(sessionRequest, sessionListener, receiverListener, opt_autoJoinPolicy, opt_defaultActionPolicy)

Holds the configuraton for the API when initialized.

Parameters

Name Description

sessionRequest

chrome.cast.SessionRequest

The session request.

Value must not be null.

sessionListener

function(non-null chrome.cast.Session)

A listener to notify when a session is available to the application.

receiverListener

function(non-null chrome.cast.ReceiverAvailability)

A listener to notify when there is a receiver available.

opt_autoJoinPolicy

Optional

chrome.cast.AutoJoinPolicy

The auto join policy for the application.

opt_defaultActionPolicy

Optional

chrome.cast.DefaultActionPolicy

The default action to take when the user is already casting when the application is initialized.

Properties

autoJoinPolicy

non-null chrome.cast.AutoJoinPolicy

Determines whether the SDK will automatically connect to a running session after initialization.

Default value
chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED

defaultActionPolicy

non-null chrome.cast.DefaultActionPolicy

Requests whether the application should be launched on API initialization when the tab is already being cast. Apps in embedded content (like iframes) should set this field to CAST_THIS_TAB if they are not the main app on the page. This value also configures the default behavior of the extension popup for the page.

Default value
chrome.cast.DefaultActionPolicy.CREATE_SESSION

receiverListener

function(non-null chrome.cast.ReceiverAvailability)

Function invoked when the availability of a Cast receiver that supports the application in sessionRequest is known or changes. This function will always be invoked at least once after initialization completes.

sessionListener

function(non-null chrome.cast.Session)

Listener invoked when a session is created or connected by the SDK. This function may be invoked after initialization, if there is a session that is automatically created or connected. Note that requestSession method does not cause this listener to be invoked, since it has its own success callback.

sessionRequest

non-null chrome.cast.SessionRequest

Describes the session to launch or the session to connect.