總覽
用於控制 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 |
每當用戶端的 mediaStatus 物件變更時,由子類別呼叫。
由「GCKRemoteMediaClient(Protected)」類別提供。
- (void) notifyDidUpdateQueue |
每次由用戶端管理的媒體佇列變更時,由子類別呼叫。
由「GCKRemoteMediaClient(Protected)」類別提供。
- (void) notifyDidUpdatePreloadStatus |
在用戶端的 MediaStatus 的 GCKMediaStatus::preloadedItemID 變更時,子類別會呼叫該函式。
由「GCKRemoteMediaClient(Protected)」類別提供。
- (void) notifyDidUpdateMetadata |
每當中繼資料變更時,由子類別呼叫。
由「GCKRemoteMediaClient(Protected)」類別提供。
資源詳細資料
|
readnonatomicassign |
表示此物件是否連線至工作階段的標記。
|
readnonatomicstrong |
目前的媒體狀態,由媒體控制管道回報。
|
readnonatomicassign |
上次收到媒體狀態更新後經過的時間。
如果目前正在處理某項狀態要求,這會顯示為 0。
|
readwritenonatomicweak |
能從 GCKMediaStatus 物件中的自訂資料擷取廣告插播資訊的委派代表。