cast. 架構。 CastContext
            管理投放互動。使用 getInstance 擷取的單例模式物件。管理狀態:提供投放圖示和工作階段物件的狀態。除非 setOptions 提供投放選項,否則不支援投放互動。
建構函式
CastContext
新 CastContext()
方法
getInstance
getInstance() returns cast.framework.CastContext
傳回 CastContext 單例模式執行個體。
- 傳回
 - 
                  
cast.framework.CastContextCastContext 的單例模式執行個體。 
addEventListener
addEventListener(type, handler)
新增事件監聽器。
                      參數 | 
                  |
|---|---|
| 
                         類型  | 
                      
                         cast.framework.CastContextEventType 這是指活動類型。 值不得為空值。  | 
                    
| 
                         處理常式  | 
                      
                         (non-null function(non-null cast.framework.CastStateEventData) or non-null function(non-null cast.framework.SessionStateEventData))  | 
                    
endCurrentSession
endCurrentSession(stopCasting)
結束目前的工作階段。
                      參數 | 
                  |
|---|---|
| 
                         stopCasting  | 
                      
                         boolean 接收器應用程式是否停止運作或中斷連線。  | 
                    
getCastState
getCastState() 傳回 cast.framework.CastState
- 傳回
 - 
                  
non-null cast.framework.CastState目前的投放圖示狀態。 
getCurrentSession
getCurrentSession() 會傳回 cast.framework.CastSession
- 傳回
 - 
                  
nullable cast.framework.CastSession目前工作階段。 
getSessionState
getSessionState() 會傳回 cast.framework.SessionState
- 傳回
 - 
                  
non-null cast.framework.SessionState目前工作階段狀態。 
removeEventListener
removeEventListener(type, handler)
移除事件監聽器。
                      參數 | 
                  |
|---|---|
| 
                         類型  | 
                      
                         cast.framework.CastContextEventType 這是指活動類型。 值不得為空值。  | 
                    
| 
                         處理常式  | 
                      
                         (non-null function(non-null cast.framework.CastStateEventData) or non-null function(non-null cast.framework.SessionStateEventData))  | 
                    
requestSession
requestSession() 會傳回包含可為空值的 chrome.cast.ErrorCode
開啟投放選擇 UI,讓使用者開始或停止工作階段。
- 擲回
 - 
                  
Error如果尚未提供內容選項, - 傳回
 - 
                  
non-null Promise containing nullable chrome.cast.ErrorCode保證工作階段正在啟動或失敗 (遭拒絕,並顯示錯誤代碼)。 
setLaunchCredentialsData
setLaunchCredentialsData(credentialsData)
設定使用者憑證資料。如果在 setOptions 之前呼叫,則會忽略。如果在 setLaunchCredentialsData 之後呼叫 setOptions,系統會清除 setLaunchCredentialsData 中設定的值。
                      參數 | 
                  |
|---|---|
| 
                         credentialsData  | 
                      
                        
                         用於識別傳送者憑證的憑證資料。 值不得為空值。  | 
                    
setOptions
setOptions(options)
設定投放選項。 只有在設定提供設定後,系統才會傳送事件。
                      參數 | 
                  |
|---|---|
| 
                         選項  | 
                      
                        
                         網頁的投放選項。 值不得為空值。  | 
                    
- 擲回
 - 
                  
non-null Error如果選項缺少應用程式 ID,