總覽
此類別可管理使用接收端裝置的投放工作階段。
工作階段是由 GCKSessionManager 自動建立及管理。應用程式不應直接呼叫工作階段生命週期方法,例如 start (GCKSession(Protected)) 或 endAndStopCasting: (GCKSession(Protected))。
- 開始時間
- 3.0
繼承 GCKSession。
資源摘要 | |
GCKActiveInputStatus | activeInputStatus |
裝置目前的「有效輸入」狀態。更多... | |
GCKStandbyStatus | standbyStatus |
裝置目前的「待機」狀態。更多... | |
GCKApplicationMetadata * | applicationMetadata |
目前在接收端裝置上執行的接收器應用程式中繼資料 (如果有的話);否則為 nil 。更多... | |
GCKDevice * | device |
與這個工作階段相關聯的裝置。更多... | |
NSString * | sessionID |
目前的工作階段 ID (如果有的話)。更多... | |
GCKConnectionState | connectionState |
目前工作階段連線狀態,更多... | |
BOOL | suspended |
此標記會指出工作階段目前是否暫停。更多... | |
NSString * | deviceStatusText |
目前的裝置狀態文字。更多... | |
GCKSessionTraits * | traits |
工作階段特性。更多... | |
float | currentDeviceVolume |
目前裝置音量,範圍為 [0.0, 1.0]。更多... | |
BOOL | currentDeviceMuted |
目前裝置的靜音狀態。更多... | |
GCKRemoteMediaClient * | remoteMediaClient |
GCKRemoteMediaClient 物件可用於在這個工作階段中控制媒體播放。更多... | |
GCKMediaMetadata * | mediaMetadata |
目前的媒體中繼資料 (如果有的話)。更多... | |
方法詳細資料
- (instancetype) initWithDevice: | (GCKDevice *) | device | |
sessionID: | (NSString *__nullable) | sessionID | |
castOptions: | (GCKCastOptions *) | castOptions | |
指定初始化器。
使用指定的投放選項建構新的投放工作階段。
- Parameters
-
device The receiver device. sessionID The session ID, if resuming; otherwise nil
.castOptions The Cast options.
- (BOOL) addChannel: | (GCKCastChannel *) | channel |
以工作階段註冊頻道。
如果工作階段已連線,且接收器應用程式支援頻道的命名空間,則系統會自動連結管道。如果工作階段未連線,頻道會處於中斷連線狀態,直到工作階段開始為止。
- Parameters
-
channel The channel to register.
- 傳回
YES
如果頻道註冊成功,則設為NO
。
- (BOOL) removeChannel: | (GCKCastChannel *) | channel |
從工作階段中移除之前註冊的頻道。
- Parameters
-
channel The channel to unregister.
- 傳回
YES
如果頻道已成功取消註冊,則NO
否則。
- (void) addDeviceStatusListener: | (id< GCKCastDeviceStatusListener >) | listener |
將 GCKCastDeviceStatusListener 新增至這個物件的事件監聽器清單。
- Parameters
-
listener The listener to add.
- (void) removeDeviceStatusListener: | (id< GCKCastDeviceStatusListener >) | listener |
從此物件的事件監聽器清單中移除 GCKCastDeviceStatusListener。
- Parameters
-
listener The listener to remove.
- (GCKRequest *) setDeviceVolume: | (float) | volume | |
forMultizoneDevice: | (GCKMultizoneDevice *) | device | |
在多可用區群組中設定個別裝置的音量。
這是非同步作業。
- Parameters
-
volume The new volume, in the range [0.0, 1.0]. device The multizone device.
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- (GCKRequest *) setDeviceMuted: | (BOOL) | muted | |
forMultizoneDevice: | (GCKMultizoneDevice *) | device | |
在多區域群組中設定個別裝置的靜音狀態。
這是非同步作業。
- Parameters
-
muted The new muted state. device The multizone device.
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- (GCKRequest *) requestMultizoneStatus |
向多可用區群組要求多可用區狀態。
這是非同步作業。收到多可用區狀態時,系統會訊息 castSession:didReceiveMultizoneStatus: (GCKCastDeviceStatusListener-p) 委派方法。
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- (instancetype) initWithDevice: | (GCKDevice *) | device | |
traits: | (GCKSessionTraits *) | traits | |
sessionID: | (NSString *__nullable) | 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.
- (GCKRequest *) setDeviceVolume: | (float) | volume |
設定裝置音量。
這是非同步作業。預設實作為免人工管理,會導致要求失敗,並顯示 GCKErrorCodeUnsupportedFeature 錯誤。
- Parameters
-
volume The new volume.
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- 開始時間
- 3.4;在先前的架構版本中,這個方法傳回了
void
。
- (GCKRequest *) setDeviceMuted: | (BOOL) | muted |
設定裝置的靜音狀態。
這是非同步作業。預設實作為免人工管理,會導致要求失敗,並顯示 GCKErrorCodeUnsupportedFeature 錯誤。
- Parameters
-
muted The new mute state.
- 傳回
- 用於追蹤要求的 GCKRequest 物件。
- 開始時間
- 3.4;在先前的架構版本中,這個方法傳回了
void
。
- (void) start |
- (void) endAndStopCasting: | (BOOL) | stopCasting |
結束工作階段。
這是非同步作業。必須由子類別覆寫。
- Parameters
-
stopCasting Whether to stop casting content to the receiver.
由「GCKSession(Protected)」類別提供。
- (void) suspendWithReason: | (GCKConnectionSuspendReason) | reason |
- (void) resume |
- (void) notifyDidStartWithSessionID: | (NSString *) | sessionID |
- (void) notifyDidFailToStartWithError: | (NSError *) | error |
- (void) notifyDidResume |
子類別會呼叫,以通知架構已繼續工作階段。
由「GCKSession(Protected)」類別提供。
- (void) notifyDidSuspendWithReason: | (GCKConnectionSuspendReason) | reason |
子類別會呼叫以通知架構,說明工作階段已暫停。
- Parameters
-
reason The reason for the suspension.
由「GCKSession(Protected)」類別提供。
- (void) notifyDidEndWithError: | (NSError *__nullable) | error |
子類別會呼叫以通知架構,說明工作階段已結束。
- Parameters
-
error The error that caused the session to end, if any. Should be nil
if the session was ended intentionally.
由「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: | (NSString *__nullable) | statusText |
資源詳情
|
readnonatomicassign |
裝置目前的「有效輸入」狀態。
|
readnonatomicassign |
裝置目前的「待機」狀態。
|
readnonatomiccopy |
目前在接收端裝置上執行的接收器應用程式中繼資料 (如果有的話);否則為 nil
。
|
readnonatomicstronginherited |
與這個工作階段相關聯的裝置。
|
readnonatomiccopyinherited |
目前的工作階段 ID (如果有的話)。
|
readnonatomicassigninherited |
目前工作階段連線狀態,
|
readnonatomicassigninherited |
此標記會指出工作階段目前是否暫停。
|
readnonatomiccopyinherited |
目前的裝置狀態文字。
|
readnonatomiccopyinherited |
工作階段特性。
|
readnonatomicassigninherited |
目前裝置音量,範圍為 [0.0, 1.0]。
|
readnonatomicassigninherited |
目前裝置的靜音狀態。
|
readnonatomicstronginherited |
GCKRemoteMediaClient 物件可用於在這個工作階段中控制媒體播放。
nil
是指工作階段開始之前,或是工作階段不支援 GCKRemoteMediaClient API。提供 GCKRemoteMediaClient 介面的子類別必須覆寫 getter 方法。
|
readnonatomicstronginherited |
目前的媒體中繼資料 (如果有的話)。
如果工作階段不支援媒體命名空間,或是目前接收器上未載入任何媒體,則為 nil
。