總覽
這個類別用於控制 Cast 接收器上的媒體播放。
這個類別提供的功能與已淘汰的 GCKMediaControlChannel 相同,但 API 更方便使用。主要差異如下:
- 每個要求都以 GCKRequest 物件表示,可透過專屬委派項目追蹤。
- GCKRemoteMediaClient 支援多個接聽程式,而非單一委派。
- 成立時間
- 3.0
繼承 NSObject。
房源摘要 | |
BOOL | connected |
這個標記表示這個物件是否已連線至工作階段。更多... | |
GCKMediaStatus * | mediaStatus |
媒體控制管道回報的目前媒體狀態。更多... | |
NSTimeInterval | timeSinceLastMediaStatusUpdate |
自上次收到媒體狀態更新以來經過的時間量。更多... | |
id< GCKRemoteMediaClientAdInfoParserDelegate > | adInfoParserDelegate |
委派項目,可從 GCKMediaStatus 物件的自訂資料中擷取廣告插斷資訊。更多... | |
方法詳細資料
- (void) addListener: | (id< GCKRemoteMediaClientListener >) | listener |
將監聽器新增至這個物件的監聽器清單。
- Parameters
-
listener The listener to add.
- (void) removeListener: | (id< GCKRemoteMediaClientListener >) | listener |
從這個物件的監聽器清單中移除監聽器。
- Parameters
-
listener The listener to remove.
- (GCKRequest *) loadMedia: | (GCKMediaInformation *) | mediaInfo |
載入並開始播放新的媒體項目。
- Parameters
-
mediaInfo An object describing the media item to load.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) loadMedia: | (GCKMediaInformation *) | mediaInfo | |
autoplay: | (BOOL) | autoplay | |
載入新的媒體項目,並視需要開始播放。
- Parameters
-
mediaInfo An object describing the media item to load. autoplay Whether playback should start immediately.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) loadMedia: | (GCKMediaInformation *) | mediaInfo | |
autoplay: | (BOOL) | autoplay | |
playPosition: | (NSTimeInterval) | playPosition | |
載入新的媒體項目,並視需要開始播放。
- Parameters
-
mediaInfo An object describing the media item to load. autoplay Whether playback should start immediately. playPosition The initial playback position.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) loadMedia: | (GCKMediaInformation *) | mediaInfo | |
autoplay: | (BOOL) | autoplay | |
playPosition: | (NSTimeInterval) | playPosition | |
customData: | (id __nullable) | customData | |
載入新的媒體項目,並視需要開始播放。
- Parameters
-
mediaInfo An object describing the media item to load. autoplay Whether playback should start immediately. playPosition The initial playback position. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) loadMedia: | (GCKMediaInformation *) | mediaInfo | |
autoplay: | (BOOL) | autoplay | |
playPosition: | (NSTimeInterval) | playPosition | |
activeTrackIDs: | (NSArray< NSNumber * > *__nullable) | activeTrackIDs | |
載入新的媒體項目,並視需要開始播放。
- Parameters
-
mediaInfo An object describing the media item to load. autoplay Whether playback should start immediately. playPosition The initial playback position. activeTrackIDs An array of integers specifying the active tracks. May be nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) loadMedia: | (GCKMediaInformation *) | mediaInfo | |
autoplay: | (BOOL) | autoplay | |
playPosition: | (NSTimeInterval) | playPosition | |
activeTrackIDs: | (NSArray< NSNumber * > *__nullable) | activeTrackIDs | |
customData: | (id __nullable) | customData | |
載入新的媒體項目,並視需要開始播放。
- Parameters
-
mediaInfo An object describing the media item to load. autoplay Whether playback should start immediately. playPosition The initial playback position. activeTrackIDs An array of integers specifying the active tracks. May be nil
.customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) setActiveTrackIDs: | (NSArray< NSNumber * > *__nullable) | activeTrackIDs |
設定有效測試群組。
如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
activeTrackIDs An array of integers specifying the active tracks. May be empty or nil
to disable any currently active tracks.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) setTextTrackStyle: | (GCKMediaTextTrackStyle *__nullable) | textTrackStyle |
設定文字軌樣式。
如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
textTrackStyle The text track style. The style will not be changed if this is nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) pause |
- (GCKRequest *) pauseWithCustomData: | (id __nullable) | customData |
暫停播放目前的媒體項目。
如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) stop |
- (GCKRequest *) stopWithCustomData: | (id __nullable) | customData |
停止播放目前的媒體項目。
如果目前已載入佇列,系統會移除該佇列。如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) play |
- (GCKRequest *) playWithCustomData: | (id __nullable) | customData |
開始 (或繼續) 播放目前的媒體項目。
播放一律從串流的開頭開始。如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) seekToTimeInterval: | (NSTimeInterval) | position |
在目前的媒體項目中搜尋新位置。
如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
position The new position from the beginning of the stream.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) seekToTimeInterval: | (NSTimeInterval) | position | |
resumeState: | (GCKMediaResumeState) | resumeState | |
在目前的媒體項目中搜尋新位置。
如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
position The new position interval from the beginning of the stream. resumeState The action to take after the seek operation has finished.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) seekToTimeInterval: | (NSTimeInterval) | position | |
resumeState: | (GCKMediaResumeState) | resumeState | |
customData: | (id __nullable) | customData | |
在目前的媒體項目中搜尋新位置。
如果沒有目前的媒體狀態,要求就會失敗。
- Parameters
-
position The new position from the beginning of the stream. resumeState The action to take after the seek operation has finished. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueLoadItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems | |
startIndex: | (NSUInteger) | startIndex | |
repeatMode: | (GCKMediaRepeatMode) | repeatMode | |
載入新的媒體項目佇列,並視需要開始播放。
- Parameters
-
queueItems An array of GCKMediaQueueItem instances to load. Must not be nil
or empty.startIndex The index of the item in the items array that should be played first. repeatMode The repeat mode for playing the queue.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueLoadItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems | |
startIndex: | (NSUInteger) | startIndex | |
repeatMode: | (GCKMediaRepeatMode) | repeatMode | |
customData: | (id __nullable) | customData | |
載入新的媒體項目佇列,並視需要開始播放。
- Parameters
-
queueItems An array of GCKMediaQueueItem instances to load. Must not be nil
or empty.startIndex The index of the item in the items array that should be played first. repeatMode The repeat mode for playing the queue. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueLoadItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems | |
startIndex: | (NSUInteger) | startIndex | |
playPosition: | (NSTimeInterval) | playPosition | |
repeatMode: | (GCKMediaRepeatMode) | repeatMode | |
customData: | (id __nullable) | customData | |
載入新的媒體項目佇列,並視需要開始播放。
- Parameters
-
queueItems An array of GCKMediaQueueItem instances to load. Must not be nil
or empty.startIndex The index of the item in the items array that should be played first. playPosition The initial playback position for the item when it is first played, relative to the beginning of the stream. This value is ignored when the same item is played again, for example when the queue repeats, or the item is later jumped to. In those cases the item's startTime is used. repeatMode The repeat mode for playing the queue. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueInsertItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems | |
beforeItemWithID: | (NSUInteger) | beforeItemID | |
將新媒體項目清單插入佇列。
- Parameters
-
queueItems An array of GCKMediaQueueItem instances to insert. Must not be nil
or empty.beforeItemID The ID of the item that will be located immediately after the inserted list. If the value is kGCKMediaQueueInvalidItemID, the inserted list will be appended to the end of the queue.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueInsertItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems | |
beforeItemWithID: | (NSUInteger) | beforeItemID | |
customData: | (id __nullable) | customData | |
將新媒體項目清單插入佇列。
- Parameters
-
queueItems An array of GCKMediaQueueItem instances to insert. Must not be nil
or empty.beforeItemID ID of the item that will be located immediately after the inserted list. If the value is kGCKMediaQueueInvalidItemID, the inserted list will be appended to the end of the queue. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueInsertItem: | (GCKMediaQueueItem *) | item | |
beforeItemWithID: | (NSUInteger) | beforeItemID | |
便利方法,可將單一項目插入佇列。
- Parameters
-
item The item to insert. beforeItemID The ID of the item that will be located immediately after the inserted item. If the value is kGCKMediaQueueInvalidItemID, or does not refer to any item currently in the queue, the inserted item will be appended to the end of the queue.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueInsertAndPlayItem: | (GCKMediaQueueItem *) | item | |
beforeItemWithID: | (NSUInteger) | beforeItemID | |
便利方法,可將單一項目插入佇列,並設為目前項目。
- Parameters
-
item The item to insert. beforeItemID The ID of the item that will be located immediately after the inserted item. If the value is kGCKMediaQueueInvalidItemID, or does not refer to any item currently in the queue, the inserted item will be appended to the end of the queue.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueInsertAndPlayItem: | (GCKMediaQueueItem *) | item | |
beforeItemWithID: | (NSUInteger) | beforeItemID | |
playPosition: | (NSTimeInterval) | playPosition | |
customData: | (id __nullable) | customData | |
便利方法,可將單一項目插入佇列,並設為目前項目。
- Parameters
-
item The item to insert. beforeItemID The ID of the item that will be located immediately after the inserted item. If the value is kGCKMediaQueueInvalidItemID, or does not refer to any item currently in the queue, the inserted item will be appended to the end of the queue. playPosition The initial playback position for the item when it is first played, relative to the beginning of the stream. This value is ignored when the same item is played again, for example when the queue repeats, or the item is later jumped to. In those cases the item's startTime is used. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueUpdateItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems |
- (GCKRequest *) queueUpdateItems: | (NSArray< GCKMediaQueueItem * > *) | queueItems | |
customData: | (id __nullable) | customData | |
更新佇列。
- Parameters
-
queueItems The list of updated items. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueRemoveItemsWithIDs: | (NSArray< NSNumber * > *) | itemIDs |
從待播清單中移除媒體項目清單。
如果佇列因此清空,目前媒體工作階段就會終止。
- Parameters
-
itemIDs An array of media item IDs identifying the items to remove. Must not be nil
or empty.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueRemoveItemsWithIDs: | (NSArray< NSNumber * > *) | itemIDs | |
customData: | (id __nullable) | customData | |
從待播清單中移除媒體項目清單。
如果佇列因此清空,目前媒體工作階段就會終止。
- Parameters
-
itemIDs An array of media item IDs identifying the items to remove. Must not be nil
or empty.customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueRemoveItemWithID: | (NSUInteger) | itemID |
- (GCKRequest *) queueReorderItemsWithIDs: | (NSArray< NSNumber * > *) | queueItemIDs | |
insertBeforeItemWithID: | (NSUInteger) | beforeItemID | |
重新排序佇列中的媒體項目清單。
- Parameters
-
queueItemIDs An array of media item IDs identifying the items to reorder. Must not be nil
or empty.beforeItemID ID of the item that will be located immediately after the reordered list. If the value is kGCKMediaQueueInvalidItemID, or does not refer to any item currently in the queue, the reordered list will be appended at the end of the queue.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueReorderItemsWithIDs: | (NSArray< NSNumber * > *) | queueItemIDs | |
insertBeforeItemWithID: | (NSUInteger) | beforeItemID | |
customData: | (id __nullable) | customData | |
重新排序待播清單中的媒體項目。
- Parameters
-
queueItemIDs An array of media item IDs identifying the items to reorder. Must not be nil
or empty.beforeItemID The ID of the item that will be located immediately after the reordered list. If the value is kGCKMediaQueueInvalidItemID, or does not refer to any item currently in the queue, the reordered list will be moved to the end of the queue. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueMoveItemWithID: | (NSUInteger) | itemID | |
beforeItemWithID: | (NSUInteger) | beforeItemID | |
這個便利方法可移動佇列中的單一項目。
- Parameters
-
itemID The ID of the item to move. beforeItemID The ID of the item that will be located immediately after the reordered list. If the value is kGCKMediaQueueInvalidItemID, or does not refer to any item currently in the queue, the item will be moved to the end of the queue.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueJumpToItemWithID: | (NSUInteger) | itemID |
- (GCKRequest *) queueJumpToItemWithID: | (NSUInteger) | itemID | |
customData: | (id __nullable) | customData | |
跳到佇列中具有指定 ID 的項目。
- Parameters
-
itemID The ID of the item to jump to. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueJumpToItemWithID: | (NSUInteger) | itemID | |
playPosition: | (NSTimeInterval) | playPosition | |
customData: | (id __nullable) | customData | |
跳到佇列中具有指定 ID 的項目。
- Parameters
-
itemID The ID of the item to jump to. playPosition The initial playback position for the item when it is first played, relative to the beginning of the stream. This value is ignored when the same item is played again, for example when the queue repeats, or the item is later jumped to. In those cases the item's startTime is used. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueNextItem |
移至佇列中的下一個項目。
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queuePreviousItem |
移至佇列中的上一個項目。
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) queueSetRepeatMode: | (GCKMediaRepeatMode) | repeatMode |
- (GCKRequest *) setStreamVolume: | (float) | volume |
設定串流音量。
如果沒有目前的媒體工作階段,要求就會失敗。
- Parameters
-
volume The new volume, in the range [0.0 - 1.0].
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) setStreamVolume: | (float) | volume | |
customData: | (id __nullable) | customData | |
設定串流音量。
如果沒有目前的媒體工作階段,要求就會失敗。
- Parameters
-
volume The new volume, in the range [0.0 - 1.0]. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) setStreamMuted: | (BOOL) | muted |
設定是否將串流設為靜音。
如果沒有目前的媒體工作階段,要求就會失敗。
- Parameters
-
muted Whether the stream should be muted or unmuted.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) setStreamMuted: | (BOOL) | muted | |
customData: | (id __nullable) | customData | |
設定是否將串流設為靜音。
如果沒有目前的媒體工作階段,要求就會失敗。
- Parameters
-
muted Whether the stream should be muted or unmuted. customData Custom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil
.
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (GCKRequest *) requestStatus |
向接收端要求更新媒體狀態資訊。
- 傳回
- 用於追蹤這項要求的 GCKRequest 物件。
- (NSTimeInterval) approximateStreamPosition |
傳回根據上次收到的串流資訊和自該更新以來經過的實際時間計算出的概略串流位置。
如果管道未連線或目前未載入任何媒體,則傳回 0。
- (void) notifyDidStartMediaSession |
子類別應在媒體工作階段開始時呼叫此方法,也就是在遠端播放器成功載入新媒體後。
提供者:類別 GCKRemoteMediaClient(Protected)。
- (void) notifyDidUpdateMediaStatus |
子類別隨時可呼叫此方法,瞭解用戶端媒體狀態物件的變更。
提供者:類別 GCKRemoteMediaClient(Protected)。
- (void) notifyDidUpdateQueue |
子類別隨時可呼叫此方法,在用戶端管理的媒體佇列變更時呼叫。
提供者:類別 GCKRemoteMediaClient(Protected)。
- (void) notifyDidUpdatePreloadStatus |
每當用戶端 GCKMediaStatus::preloadedItemID 的 mediaStatus 變更時,子類別都會呼叫這個方法。
提供者:類別 GCKRemoteMediaClient(Protected)。
- (void) notifyDidUpdateMetadata |
子類別可在中繼資料變更時呼叫這個方法。
提供者:類別 GCKRemoteMediaClient(Protected)。
資源詳細資料
|
readnonatomicassign |
這個標記表示這個物件是否已連線至工作階段。
|
readnonatomicstrong |
媒體控制管道回報的目前媒體狀態。
|
readnonatomicassign |
自上次收到媒體狀態更新以來經過的時間。
如果目前正在處理狀態要求,這個值會是 0。
|
readwritenonatomicweak |
這個委派項目可從 GCKMediaStatus 物件的自訂資料中擷取廣告插斷資訊。