Class: ApiConfig

  • chrome.cast.ApiConfig holds the configuration for the Cast API and is initialized with parameters like session request, listeners, and policies.

  • It defines how the application interacts with Cast sessions, including automatic connection (autoJoinPolicy) and behavior when a tab is already casting (defaultActionPolicy).

  • Properties like sessionRequest and sessionListener manage session creation and connection, while receiverListener handles receiver availability updates.

  • Developers can configure ApiConfig to customize the Cast integration within their applications, controlling aspects like session management and receiver interaction.

Constructor

ApiConfig

new ApiConfig(sessionRequest, sessionListener, receiverListener, autoJoinPolicy, defaultActionPolicy)

Parameter

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.

autoJoinPolicy

Optional

chrome.cast.AutoJoinPolicy

The auto join policy for the application.

Value must not be null.

defaultActionPolicy

Optional

chrome.cast.DefaultActionPolicy

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

Value must not be null.

Properties

autoJoinPolicy

non-null chrome.cast.AutoJoinPolicy

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

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.

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.