GCKCastSession 類別
繼承 GCKSession。
- (instancetype) initWithDevice: |
|
(GCKDevice *) |
device |
sessionID: |
|
(nullable NSString *) |
sessionID |
sessionOptions: |
|
(nullable GCKSessionOptions *) |
sessionOptions |
castOptions: |
|
(GCKCastOptions *) |
castOptions |
|
|
| |
使用指定的投放選項建構新的投放工作階段。
- Parameters
-
device | The receiver device. |
sessionID | The session ID, if resuming; otherwise nil . |
sessionOptions | The session options, if any; otherwise nil . |
castOptions | The Cast options. |
- 開始時間
- 4.0
以工作階段註冊頻道。
如果工作階段已連線,且接收器應用程式支援頻道的命名空間,則系統會自動連結管道。如果工作階段未連線,頻道會處於中斷連線狀態,直到工作階段開始為止。
- Parameters
-
channel | The channel to register. |
- 傳回
YES
如果頻道註冊成功,則設為 NO
。
從工作階段中移除之前註冊的頻道。
- Parameters
-
channel | The channel to unregister. |
- 傳回
YES
如果頻道已成功取消註冊,則NO
否則。
在多可用區群組中設定個別裝置的音量。
這是非同步作業。
- Parameters
-
volume | The new volume, in the range [0.0, 1.0]. |
device | The multizone device. |
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
在多區域群組中設定個別裝置的靜音狀態。
這是非同步作業。
- Parameters
-
muted | The new muted state. |
device | The multizone device. |
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- (instancetype) initWithDevice: |
|
(GCKDevice *) |
device |
traits: |
|
(nullable GCKSessionTraits *) |
traits |
sessionID: |
|
(nullable NSString *) |
sessionID |
|
|
| |
使用預設選項,為指定裝置初始化新的工作階段物件。
- Parameters
-
device | The device. |
traits | The session traits. |
sessionID | The session ID of an existing session, if this object will be used to resume a session; otherwise nil if it will be used to start a new session. |
- (instancetype) initWithDevice: |
|
(GCKDevice *) |
device |
traits: |
|
(nullable GCKSessionTraits *) |
traits |
sessionID: |
|
(nullable NSString *) |
sessionID |
sessionOptions: |
|
(nullable GCKSessionOptions *) |
sessionOptions |
|
|
| |
初始化指定裝置的新工作階段物件。
- Parameters
-
device | The device. |
traits | The session traits. |
sessionID | The session ID of an existing session, if this object will be used to resume a session; otherwise nil if it will be used to start a new session. |
sessionOptions | The session options, if any; otherwise nil . |
- 開始時間
- 4.0
設定裝置音量。
這是非同步作業。預設實作為免人工管理,會導致要求失敗,並顯示 GCKErrorCodeUnsupportedFeature 錯誤。
- Parameters
-
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- 開始時間
- 3.4;在先前的架構版本中,這個方法傳回了
void
。
設定裝置的靜音狀態。
這是非同步作業。預設實作為免人工管理,會導致要求失敗,並顯示 GCKErrorCodeUnsupportedFeature 錯誤。
- Parameters
-
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- 開始時間
- 3.4;在先前的架構版本中,這個方法傳回了
void
。
結束包含指定動作的工作階段。
這是非同步作業。必須由子類別覆寫。
- Parameters
-
action | The action to take when ending the session; see GCKSessionEndAction for more details. |
由「GCKSession(Protected)」類別提供。
- (void) notifyDidStartWithSessionID: |
|
(NSString *) |
sessionID |
|
- (void) notifyDidFailToStartWithError: |
|
(GCKError *) |
error |
|
- (void) notifyDidEndWithError: |
|
(nullable NSError *) |
error |
willTryToResume: |
|
(BOOL) |
willTryToResume |
|
|
| |
子類別會呼叫以通知架構,說明工作階段已結束。
- Parameters
-
error | The error that caused the session to end, if any. Should be nil if the session was ended intentionally. |
willTryToResume | Whether the session will try to resume itself automatically. |
由「GCKSession(Protected)」類別提供。
- (void) notifyDidReceiveDeviceVolume: |
|
(float) |
volume |
muted: |
|
(BOOL) |
muted |
|
|
| |
子類別會呼叫此 API,通知架構已收到裝置傳來的更新音量和靜音狀態。
- Parameters
-
volume | The device's current volume. Must be in the range [0, 1.0]; |
muted | The device's current mute state. |
由「GCKSession(Protected)」類別提供。
- (void) notifyDidReceiveDeviceStatus: |
|
(nullable NSString *) |
statusText |
|
- (GCKActiveInputStatus) activeInputStatus |
|
readnonatomicassign |
- (GCKStandbyStatus) standbyStatus |
|
readnonatomicassign |
目前在接收端裝置上執行的接收器應用程式中繼資料 (如果有的話);否則為 nil
。
|
readnonatomicstronginherited |
|
readnonatomiccopyinherited |
- (GCKSessionOptions*) sessionOptions |
|
readnonatomicstronginherited |
- (GCKConnectionState) connectionState |
|
readnonatomicassigninherited |
|
readnonatomicassigninherited |
- (NSString*) deviceStatusText |
|
readnonatomiccopyinherited |
|
readnonatomiccopyinherited |
- (float) currentDeviceVolume |
|
readnonatomicassigninherited |
- (BOOL) currentDeviceMuted |
|
readnonatomicassigninherited |
|
readnonatomicstronginherited |
|
readnonatomicstronginherited |
目前的媒體中繼資料 (如果有的話)。
如果工作階段不支援媒體命名空間,或是目前接收器上未載入任何媒體,則為 nil
。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2023-12-02 (世界標準時間)。
[null,null,["上次更新時間:2023-12-02 (世界標準時間)。"],[[["`GCKCastSession` manages a Cast session and its lifecycle, including channels, device status, and volume control, but applications should avoid directly managing the session's start and end."],["`GCKCastSession` provides properties for accessing session status, device information (like volume and mute state), and media control via `remoteMediaClient`."],["`GCKSession` is an abstract base class for Cast sessions, requiring subclasses to implement session start/end logic and provides properties for session status, device details, and media information."],["Subclasses of `GCKSession` use protected methods to notify the framework about session lifecycle events like start, end, errors, and device status changes."]]],["The `GCKCastSession` class manages Cast sessions, created by `GCKSessionManager`. Key actions include constructing sessions with options, registering/removing channels, and adding/removing device status listeners. It supports setting device volume and mute states, requesting multizone status, and controlling media playback. Subclasses use methods to notify the framework about session lifecycle events, device status, and connection status. It provides properties for session, device, and media status, with deprecated methods.\n"]]