概览
用于控制 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 |
当客户端的 GCKMediaStatus::preloadedItemID 发生 mediaStatus 更改时,由子类调用。
由类别 GCKRemoteMediaClient(Protected) 提供。
- (void) notifyDidUpdateMetadata |
供子类在元数据发生更改时调用。
由类别 GCKRemoteMediaClient(Protected) 提供。
媒体资源详情
|
readnonatomicassign |
一个标志,用于指示相应对象是否已连接到会话。
|
readnonatomicstrong |
媒体控制通道报告的当前媒体状态。
|
readnonatomicassign |
自上次收到媒体状态更新以来经过的时间。
如果状态请求目前正在进行中,则此值为 0。
|
readwritenonatomicweak |
一种能够从 GCKMediaStatus 对象中的自定义数据提取广告插播信息的委托。