Consente di richiedere se l'applicazione deve essere avviata all'inizializzazione dell'API quando la scheda è già in fase di trasmissione. Le app all'interno di contenuti incorporati (come iframe) devono impostare questo campo su CAST_THIS_TAB se non sono l'app principale nella pagina. Questo valore configura anche il comportamento predefinito del popup dell'estensione per la pagina.
Funzione richiamata quando è nota o cambia la disponibilità di un ricevitore di trasmissione che supporta l'applicazione in sessionRequest. Questa funzione verrà sempre richiamata almeno una volta dopo il completamento dell'inizializzazione.
Listener richiamato quando viene creata o connessa una sessione dall'SDK.
Questa funzione può essere richiamata dopo l'inizializzazione, se è presente una sessione creata o connessa automaticamente. Tieni presente che il metodo requestSession non attiva la chiamata di questo listener, poiché dispone di un proprio callback di esito positivo.
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[[["\u003cp\u003e\u003ccode\u003echrome.cast.ApiConfig\u003c/code\u003e holds the configuration for the Cast API and is initialized with parameters like session request, listeners, and policies.\u003c/p\u003e\n"],["\u003cp\u003eIt defines how the application interacts with Cast sessions, including automatic connection (autoJoinPolicy) and behavior when a tab is already casting (defaultActionPolicy).\u003c/p\u003e\n"],["\u003cp\u003eProperties like \u003ccode\u003esessionRequest\u003c/code\u003e and \u003ccode\u003esessionListener\u003c/code\u003e manage session creation and connection, while \u003ccode\u003ereceiverListener\u003c/code\u003e handles receiver availability updates.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can configure \u003ccode\u003eApiConfig\u003c/code\u003e to customize the Cast integration within their applications, controlling aspects like session management and receiver interaction.\u003c/p\u003e\n"]]],[],null,["# Class: ApiConfig\n\nchrome.[cast](/cast/docs/reference/web_sender/chrome.cast).ApiConfig\n====================================================================\n\nclass static\n\nHolds the configuration for the API when initialized.\n\nConstructor\n-----------\n\n### ApiConfig\n\nnew\nApiConfig(sessionRequest, sessionListener, receiverListener, autoJoinPolicy, defaultActionPolicy)\n\n| #### Parameter ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| sessionRequest | [chrome.cast.SessionRequest](/cast/docs/reference/web_sender/chrome.cast.SessionRequest) The session request. Value must not be null. |\n| sessionListener | function(non-null [chrome.cast.Session](/cast/docs/reference/web_sender/chrome.cast.Session)) A listener to notify when a session is available to the application. |\n| receiverListener | function(non-null [chrome.cast.ReceiverAvailability](/cast/docs/reference/web_sender/chrome.cast#.ReceiverAvailability)) A listener to notify when there is a receiver available. |\n| autoJoinPolicy | Optional [chrome.cast.AutoJoinPolicy](/cast/docs/reference/web_sender/chrome.cast#.AutoJoinPolicy) The auto join policy for the application. Value must not be null. |\n| defaultActionPolicy | Optional [chrome.cast.DefaultActionPolicy](/cast/docs/reference/web_sender/chrome.cast#.DefaultActionPolicy) The default action to take when the user is already casting when the application is initialized. Value must not be null. |\n\nProperties\n----------\n\n### autoJoinPolicy\n\nnon-null [chrome.cast.AutoJoinPolicy](/cast/docs/reference/web_sender/chrome.cast#.AutoJoinPolicy)\n\nDetermines whether the SDK will automatically connect to a running\nsession after initialization.\n\n### defaultActionPolicy\n\nnon-null [chrome.cast.DefaultActionPolicy](/cast/docs/reference/web_sender/chrome.cast#.DefaultActionPolicy)\n\nRequests whether the application should be launched on API initialization\nwhen the tab is already being cast. Apps in embedded content (like\niframes) should set this field to CAST_THIS_TAB if they are not the main\napp on the page. This value also configures the default behavior of the\nextension popup for the page.\n\n### receiverListener\n\nfunction(non-null [chrome.cast.ReceiverAvailability](/cast/docs/reference/web_sender/chrome.cast#.ReceiverAvailability))\n\nFunction invoked when the availability of a Cast receiver that supports\nthe application in sessionRequest is known or changes. This function\nwill always be invoked at least once after initialization completes.\n\n### sessionListener\n\nfunction(non-null [chrome.cast.Session](/cast/docs/reference/web_sender/chrome.cast.Session))\n\nListener invoked when a session is created or connected by the SDK.\nThis function may be invoked after initialization, if there is a\nsession that is automatically created or connected. Note that\nrequestSession method does not cause this listener to be invoked,\nsince it has its own success callback.\n\n### sessionRequest\n\nnon-null [chrome.cast.SessionRequest](/cast/docs/reference/web_sender/chrome.cast.SessionRequest)\n\nDescribes the session to launch or the session to connect."]]