總覽
抽象基本類別,代表與接收器裝置的工作階段。
子類別必須實作 start (GCKSession(Protected))、endAndStopCasting: (GCKSession(Protected))、suspendWithReason: (GCKSession(Protected)) 和 resume (GCKSession(Protected)) 方法,並呼叫適當的通知程式方法 (例如 notifyDidStartWithSessionID: (GCKSession(Protected))),指出工作階段狀態的相應變化。如果裝置支援這類作業,子類別也可以實作 setDeviceVolume: (GCKSession)、setDeviceMuted: (GCKSession) 和 remoteMediaClient。
工作階段是使用 GCKSessionManager 中的工作階段方法建立及控制,這些方法會使用適當的 GCKDeviceProvider 建立工作階段,然後將工作階段要求委派給該 GCKSession 物件。
- 成立時間
- 3.0
繼承 NSObject。
由 GCKCastSession 繼承。
執行個體方法摘要 | |
(instancetype) | - initWithDevice:traits:sessionID: |
為指定裝置初始化新的工作階段物件。更多... | |
(GCKRequest *) | - setDeviceVolume: |
設定裝置音量。更多... | |
(GCKRequest *) | - setDeviceMuted: |
設定裝置的靜音狀態。更多... | |
(void) | - start |
啟動工作階段。更多... | |
(void) | - endAndStopCasting: |
結束工作階段。更多... | |
(void) | - suspendWithReason: |
基於指定原因暫停工作階段。更多... | |
(void) | - resume |
繼續執行工作階段。更多... | |
(void) | - notifyDidStartWithSessionID: |
子類別會呼叫這個方法,通知架構工作階段已啟動。更多... | |
(void) | - notifyDidFailToStartWithError: |
子類別會呼叫這個方法,通知架構工作階段無法啟動。更多... | |
(void) | - notifyDidResume |
子類別會呼叫這個方法,通知架構工作階段已恢復。更多... | |
(void) | - notifyDidSuspendWithReason: |
子類別會呼叫此函式,通知架構工作階段已暫停。更多... | |
(void) | - notifyDidEndWithError: |
子類別會呼叫這個方法,通知架構工作階段已結束。更多... | |
(void) | - notifyDidReceiveDeviceVolume:muted: |
子類別會呼叫這個方法,通知架構已從裝置收到更新的裝置音量和靜音狀態。更多... | |
(void) | - notifyDidReceiveDeviceStatus: |
子類別會呼叫此方法,通知架構已從裝置收到更新狀態。更多... | |
房源摘要 | |
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 | |
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 | |
子類別會呼叫這個方法,通知架構已從裝置收到更新的裝置音量和靜音狀態。
- 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 |
資源詳細資料
|
readnonatomicstrong |
與這個工作階段相關聯的裝置。
|
readnonatomiccopy |
目前的工作階段 ID (如有)。
|
readnonatomicassign |
目前的工作階段連線狀態。
|
readnonatomicassign |
指出工作階段目前是否已暫停的旗標。
|
readnonatomiccopy |
裝置目前的狀態文字。
|
readnonatomiccopy |
工作階段特徵。
|
readnonatomicassign |
目前裝置的音量,範圍為 [0.0, 1.0]。
|
readnonatomicassign |
目前裝置的靜音狀態。
|
readnonatomicstrong |
可用於控制這個工作階段中媒體播放的 GCKRemoteMediaClient 物件。
nil
,或工作階段不支援 GCKRemoteMediaClient API。提供 GCKRemoteMediaClient 介面的子類別必須覆寫 getter 方法。
|
readnonatomicstrong |
目前的媒體中繼資料 (如有)。
如果工作階段不支援媒體命名空間,或接收器目前未載入任何媒體,則為 nil
。