GCKMediaControlChannel 类

GCKMediaControlChannel 类参考

概览

用于媒体控制操作的 GCKCastChannel 子类。

任何适用于当前有效媒体流的操作(播放、暂停、搜寻、停止等)都需要有效的(即非 null)媒体状态,否则将返回 kGCKInvalidRequestID 且不会发送请求。当频道连接时,系统会自动请求媒体状态;媒体状态包含在成功完成的加载响应中,也可以随时更新。媒体状态也可能随时变为 nil;例如,如果频道暂时断开连接,就会发生这种情况。使用此渠道时,应通过 mediaControlChannelDidUpdateStatus: (GCKMediaControlChannelDelegate-p) 回调监控媒体状态变化,并且只有在媒体状态不为 nil 时才能调用对流执行操作的方法。

如果成功启动请求,相应的方法会返回分配给该请求的请求 ID。如果请求启动失败,该方法会返回 kGCKInvalidRequestID 并设置 lastError 属性以指明失败原因。如果请求成功启动但最终失败,系统会调用 mediaControlChannel:requestDidFailWithID:error: (GCKMediaControlChannelDelegate-p) 回调来指示失败。

如需查看委托协议,请参阅 GCKMediaControlChannelDelegate

Deprecated:
使用 GCKCastSessionGCKRemoteMediaClient 属性来控制媒体播放。

继承 GCKCastChannel

实例方法摘要

(instancetype) - init
 指定初始化程序。更多…
 
(NSInteger) - loadMedia:
 加载并开始播放新的媒体内容。更多…
 
(NSInteger) - loadMedia:autoplay:
 加载新的媒体项并可选择开始播放。更多…
 
(NSInteger) - loadMedia:autoplay:playPosition:
 加载新的媒体项并可选择开始播放。更多…
 
(NSInteger) - loadMedia:autoplay:playPosition:customData:
 加载新的媒体项并可选择开始播放。更多…
 
(NSInteger) - loadMedia:autoplay:playPosition:activeTrackIDs:
 加载新的媒体项并可选择开始播放。更多…
 
(NSInteger) - loadMedia:autoplay:playPosition:activeTrackIDs:customData:
 加载新的媒体项并可选择开始播放。更多…
 
(NSInteger) - setActiveTrackIDs:
 设置有效轨道。更多…
 
(NSInteger) - setTextTrackStyle:
 设置文本轨道样式。更多…
 
(NSInteger) - pause
 暂停播放当前媒体项。更多…
 
(NSInteger) - pauseWithCustomData:
 暂停播放当前媒体项。更多…
 
(NSInteger) - stop
 停止播放当前媒体项。更多…
 
(NSInteger) - stopWithCustomData:
 停止播放当前媒体项。更多…
 
(NSInteger) - play
 开始(或继续)播放当前媒体项。更多…
 
(NSInteger) - playWithCustomData:
 开始(或继续)播放当前媒体项。更多…
 
(NSInteger) - seekToTimeInterval:
 在当前媒体项中搜索新位置。更多…
 
(NSInteger) - seekToTimeInterval:resumeState:
 在当前媒体项中搜索新位置。更多…
 
(NSInteger) - seekToTimeInterval:resumeState:customData:
 在当前媒体项中搜索新位置。更多…
 
(NSInteger) - queueLoadItems:startIndex:repeatMode:
 加载新的媒体内容队列,并可选择开始播放。更多…
 
(NSInteger) - queueLoadItems:startIndex:repeatMode:customData:
 加载新的媒体内容队列,并可选择开始播放。更多…
 
(NSInteger) - queueLoadItems:startIndex:playPosition:repeatMode:customData:
 加载新的媒体内容队列,并可选择开始播放。更多…
 
(NSInteger) - queueInsertItems:beforeItemWithID:
 将新媒体项列表插入队列。更多…
 
(NSInteger) - queueInsertItems:beforeItemWithID:customData:
 将新媒体项列表插入队列。更多…
 
(NSInteger) - queueInsertItem:beforeItemWithID:
 一种便捷方法,用于将单个项插入到队列中。更多…
 
(NSInteger) - queueInsertAndPlayItem:beforeItemWithID:
 一种便捷方法,用于将单个项插入队列并将其设为当前项。更多…
 
(NSInteger) - queueInsertAndPlayItem:beforeItemWithID:playPosition:customData:
 一种便捷方法,用于将单个项插入队列并将其设为当前项。更多…
 
(NSInteger) - queueUpdateItems:
 更新队列。更多…
 
(NSInteger) - queueUpdateItems:customData:
 更新队列。更多…
 
(NSInteger) - queueRemoveItemsWithIDs:
 从队列中移除媒体内容列表。更多…
 
(NSInteger) - queueRemoveItemsWithIDs:customData:
 从队列中移除媒体内容列表。更多…
 
(NSInteger) - queueRemoveItemWithID:
 一种便捷方法,用于从队列中移除单个项。更多…
 
(NSInteger) - queueReorderItemsWithIDs:insertBeforeItemWithID:
 对队列中的媒体内容列表重新排序。更多…
 
(NSInteger) - queueReorderItemsWithIDs:insertBeforeItemWithID:customData:
 重新排列队列中的媒体内容列表。更多…
 
(NSInteger) - queueMoveItemWithID:beforeItemWithID:
 一种便捷方法,用于移动队列中的单个项。更多…
 
(NSInteger) - queueJumpToItemWithID:
 跳转到队列中具有指定 ID 的项。更多…
 
(NSInteger) - queueJumpToItemWithID:customData:
 跳转到队列中具有指定 ID 的项。更多…
 
(NSInteger) - queueJumpToItemWithID:playPosition:customData:
 跳转到队列中具有指定 ID 的项。更多…
 
(NSInteger) - queueNextItem
 移至队列中的下一项。更多…
 
(NSInteger) - queuePreviousItem
 移至队列中的上一项。更多…
 
(NSInteger) - queueSetRepeatMode:
 设置队列重复模式。更多…
 
(NSInteger) - setStreamVolume:
 设置媒体流音量。更多…
 
(NSInteger) - setStreamVolume:customData:
 设置媒体流音量。更多…
 
(NSInteger) - setStreamMuted:
 设置直播是否静音。更多…
 
(NSInteger) - setStreamMuted:customData:
 设置直播是否静音。更多…
 
(NSInteger) - requestStatus
 从接收器请求更新后的媒体状态信息。更多…
 
(NSTimeInterval) - approximateStreamPosition
 返回根据上次收到的流信息和自该更新以来经过的实际时间计算出的近似流位置。更多…
 
(BOOL) - cancelRequestWithID:
 取消正在进行的请求。更多…
 
(instancetype) - initWithNamespace:
 指定初始化程序。更多…
 
(void) - didReceiveTextMessage:
 当在此渠道上收到短信时调用。更多…
 
(BOOL) - sendTextMessage:
 在此渠道上发送短信。更多…
 
(BOOL) - sendTextMessage:error:
 在此渠道上发送短信。更多…
 
(NSInteger) - generateRequestID
 为新消息生成请求 ID。更多…
 
(NSNumber *__nullable) - generateRequestNumber
 一种便捷方法,用于将 generateRequestID 的结果封装在 NSNumber 中。更多…
 
(void) - didConnect
 当此渠道已连接时调用,表示现在可以通过此渠道与 Cast 设备交换消息。更多…
 
(void) - didDisconnect
 当此渠道已断开连接时调用,表示无法再通过此渠道与 Cast 设备交换消息。更多…
 

房源摘要

GCKMediaStatusmediaStatus
 当前加载的媒体的媒体状态(如果有);否则为 nil更多…
 
NSTimeInterval timeSinceLastMediaStatusUpdate
 自上次收到媒体状态更新以来经过的时间。更多…
 
GCKErrorlastError
 上次请求的错误详情(如有),如果上次请求成功,则为 nil更多…
 
id< GCKMediaControlChannelDelegatedelegate
 用于接收有关渠道状态变化的通知的委托。更多…
 
NSString * protocolNamespace
 频道的命名空间。更多…
 
BOOL isConnected
 一个标志,用于指示相应渠道当前是否已连接。更多…
 
GCKDeviceManagerdeviceManager
 相应渠道注册到的设备管理器(如果有)。更多…
 

方法详细信息

- (instancetype) init

指定初始化程序。

实现了 GCKCastChannel

- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo

加载并开始播放新的媒体内容。

Parameters
mediaInfoAn object describing the media item to load.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay 

加载新的媒体项并选择性地开始播放。

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition 

加载新的媒体项并选择性地开始播放。

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
playPositionThe initial playback position.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition
customData: (id __nullable)  customData 

加载新的媒体项并选择性地开始播放。

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
playPositionThe initial playback position.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition
activeTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs 

加载新的媒体项并选择性地开始播放。

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
playPositionThe initial playback position.
activeTrackIDsAn array of integers specifying the active tracks. May be nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition
activeTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs
customData: (id __nullable)  customData 

加载新的媒体项并选择性地开始播放。

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
playPositionThe initial playback position.
activeTrackIDsAn array of integers specifying the active tracks. May be nil.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) setActiveTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs

设置有效轨道。

如果没有当前的媒体状态,请求将失败。

Parameters
activeTrackIDsAn array of integers specifying the active tracks.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID。可以是 nil 或空数组,用于将有效轨道设置为空列表。
- (NSInteger) setTextTrackStyle: (GCKMediaTextTrackStyle *__nullable)  textTrackStyle

设置文本轨道样式。

如果没有当前的媒体状态,请求将失败。

Parameters
textTrackStyleThe text track style. The style will not be changed if this is nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) pause

暂停播放当前媒体项。

如果没有当前的媒体状态,请求将失败。

返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) pauseWithCustomData: (id __nullable)  customData

暂停播放当前媒体项。

如果没有当前的媒体状态,请求将失败。

Parameters
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) stop

停止播放当前媒体项。

如果没有当前的媒体状态,请求将会失败。如果当前已加载队列,则系统会将其移除。

返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) stopWithCustomData: (id __nullable)  customData

停止播放当前媒体项。

如果没有当前的媒体状态,请求将会失败。如果当前已加载队列,则系统会将其移除。

Parameters
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) play

开始(或继续)播放当前媒体项。

播放始终从视频流的开头开始。如果没有当前的媒体状态,请求将会失败。

返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) playWithCustomData: (id __nullable)  customData

开始(或继续)播放当前媒体项。

播放始终从视频流的开头开始。如果没有当前的媒体状态,请求将失败。

Parameters
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) seekToTimeInterval: (NSTimeInterval)  position

在当前媒体项中搜索新位置。

如果没有当前的媒体状态,请求将失败。

Parameters
positionThe new position from the beginning of the stream.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) seekToTimeInterval: (NSTimeInterval)  position
resumeState: (GCKMediaControlChannelResumeState resumeState 

在当前媒体项中搜索新位置。

如果没有当前的媒体状态,请求将失败。

Parameters
positionThe new position interval from the beginning of the stream.
resumeStateThe action to take after the seek operation has finished.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) seekToTimeInterval: (NSTimeInterval)  position
resumeState: (GCKMediaControlChannelResumeState resumeState
customData: (id __nullable)  customData 

在当前媒体项中搜索新位置。

如果没有当前的媒体状态,请求将失败。

Parameters
positionThe new position from the beginning of the stream.
resumeStateThe action to take after the seek operation has finished.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) queueLoadItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
startIndex: (NSUInteger)  startIndex
repeatMode: (GCKMediaRepeatMode repeatMode 

加载新的媒体内容队列,并可选择开始播放。

Parameters
queueItemsAn array of GCKMediaQueueItem instances to load. Must not be nil or empty.
startIndexThe index of the item in the items array that should be played first.
repeatModeThe repeat mode for playing the queue.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueLoadItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
startIndex: (NSUInteger)  startIndex
repeatMode: (GCKMediaRepeatMode repeatMode
customData: (id __nullable)  customData 

加载新的媒体内容队列,并可选择开始播放。

Parameters
queueItemsAn array of GCKMediaQueueItem instances to load. Must not be nil or empty.
startIndexThe index of the item in the items array that should be played first.
repeatModeThe repeat mode for playing the queue.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueLoadItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
startIndex: (NSUInteger)  startIndex
playPosition: (NSTimeInterval)  playPosition
repeatMode: (GCKMediaRepeatMode repeatMode
customData: (id __nullable)  customData 

加载新的媒体内容队列,并可选择开始播放。

Parameters
queueItemsAn array of GCKMediaQueueItem instances to load. Must not be nil or empty.
startIndexThe index of the item in the items array that should be played first.
playPositionThe 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.
repeatModeThe repeat mode for playing the queue.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueInsertItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
beforeItemWithID: (NSUInteger)  beforeItemID 

将新媒体项列表插入队列。

Parameters
queueItemsAn array of GCKMediaQueueItem instances to insert. Must not be nil or empty.
beforeItemIDThe 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.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueInsertItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
beforeItemWithID: (NSUInteger)  beforeItemID
customData: (id __nullable)  customData 

将新媒体项列表插入队列。

Parameters
queueItemsAn array of GCKMediaQueueItem instances to insert. Must not be nil or empty.
beforeItemIDID 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.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueInsertItem: (GCKMediaQueueItem *)  item
beforeItemWithID: (NSUInteger)  beforeItemID 

一种便捷方法,用于将单个项插入到队列中。

Parameters
itemThe item to insert.
beforeItemIDThe 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.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueInsertAndPlayItem: (GCKMediaQueueItem *)  item
beforeItemWithID: (NSUInteger)  beforeItemID 

一种便捷方法,用于将单个项插入队列并将其设为当前项。

Parameters
itemThe item to insert.
beforeItemIDThe 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.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueInsertAndPlayItem: (GCKMediaQueueItem *)  item
beforeItemWithID: (NSUInteger)  beforeItemID
playPosition: (NSTimeInterval)  playPosition
customData: (id __nullable)  customData 

一种便捷方法,用于将单个项插入队列并将其设为当前项。

Parameters
itemThe item to insert.
beforeItemIDThe 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.
playPositionThe 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.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueUpdateItems: (NSArray< GCKMediaQueueItem * > *)  queueItems

更新队列。

Parameters
queueItemsThe list of updated items.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueUpdateItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
customData: (id __nullable)  customData 

更新队列。

Parameters
queueItemsThe list of updated items.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueRemoveItemsWithIDs: (NSArray< NSNumber * > *)  itemIDs

从队列中移除媒体内容列表。

如果队列因此变为空,则当前媒体会话将被终止。

Parameters
itemIDsAn array of media item IDs identifying the items to remove. Must not be nil or empty.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueRemoveItemsWithIDs: (NSArray< NSNumber * > *)  itemIDs
customData: (id __nullable)  customData 

从队列中移除媒体内容列表。

如果队列因此变为空,则当前媒体会话将被终止。

Parameters
itemIDsAn array of media item IDs identifying the items to remove. Must not be nil or empty.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueRemoveItemWithID: (NSUInteger)  itemID

一种便捷方法,用于从队列中移除单个项。

Parameters
itemIDThe ID of the item to remove.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueReorderItemsWithIDs: (NSArray< NSNumber * > *)  queueItemIDs
insertBeforeItemWithID: (NSUInteger)  beforeItemID 

对队列中的媒体内容列表重新排序。

Parameters
queueItemIDsAn array of media item IDs identifying the items to reorder. Must not be nil or empty.
beforeItemIDID 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.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueReorderItemsWithIDs: (NSArray< NSNumber * > *)  queueItemIDs
insertBeforeItemWithID: (NSUInteger)  beforeItemID
customData: (id __nullable)  customData 

重新排列队列中的媒体内容列表。

Parameters
queueItemIDsAn array of media item IDs identifying the items to reorder. Must not be nil or empty.
beforeItemIDThe 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.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueMoveItemWithID: (NSUInteger)  itemID
beforeItemWithID: (NSUInteger)  beforeItemID 

一种用于移动队列中单个项的便捷方法。

Parameters
itemIDThe ID of the item to move.
beforeItemIDThe 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.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) queueJumpToItemWithID: (NSUInteger)  itemID

跳转到队列中具有指定 ID 的项。

Parameters
itemIDThe ID of the item to jump to.
返回
相应请求的请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) queueJumpToItemWithID: (NSUInteger)  itemID
customData: (id __nullable)  customData 

跳转到队列中具有指定 ID 的项。

Parameters
itemIDThe ID of the item to jump to.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) queueJumpToItemWithID: (NSUInteger)  itemID
playPosition: (NSTimeInterval)  playPosition
customData: (id __nullable)  customData 

跳转到队列中具有指定 ID 的项。

Parameters
itemIDThe ID of the item to jump to.
playPositionThe 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.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
相应请求的请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) queueNextItem

移至队列中的下一项。

返回
相应请求的请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) queuePreviousItem

移至队列中的上一项。

返回
相应请求的请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) queueSetRepeatMode: (GCKMediaRepeatMode repeatMode

设置队列重复模式。

Parameters
repeatModeThe new repeat mode.
返回
相应请求的请求 ID;如果无法发送消息或任何参数无效,则返回 kGCKInvalidRequestID
- (NSInteger) setStreamVolume: (float)  volume

设置音频流音量。

如果没有当前的媒体会话,请求将失败。

Parameters
volumeThe new volume, in the range [0.0 - 1.0].
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) setStreamVolume: (float)  volume
customData: (id __nullable)  customData 

设置音频流音量。

如果没有当前的媒体会话,请求将失败。

Parameters
volumeThe new volume, in the range [0.0 - 1.0].
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) setStreamMuted: (BOOL)  muted

设置直播是否静音。

如果没有当前的媒体会话,请求将失败。

Parameters
mutedWhether the stream should be muted or unmuted.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) setStreamMuted: (BOOL)  muted
customData: (id __nullable)  customData 

设置直播是否静音。

如果没有当前的媒体会话,请求将失败。

Parameters
mutedWhether the stream should be muted or unmuted.
customDataCustom application-specific data to pass along with the request. Must either be an object that can be serialized to JSON using NSJSONSerialization, or nil.
返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSInteger) requestStatus

从接收器请求更新后的媒体状态信息。

返回
请求 ID;如果无法发送消息,则为 kGCKInvalidRequestID
- (NSTimeInterval) approximateStreamPosition

返回根据上次收到的流信息和自该更新以来经过的实际时间计算出的近似流位置。

如果渠道未连接或当前未加载任何媒体,则返回 0。

- (BOOL) cancelRequestWithID: (NSInteger)  requestID

取消正在进行的请求。

取消请求并不会阻止其执行;它只是表明调用应用不再关注请求的结果,因此与跟踪请求关联的任何状态都将被清除。

Parameters
requestIDThe ID of the request to cancel.
返回
如果请求已取消,则返回
YES;如果未跟踪具有指定 ID 的请求,则返回 NO
- (instancetype) initWithNamespace: (NSString *)  protocolNamespace

指定初始化程序。

使用给定的命名空间构造新的 GCKCastChannel

Parameters
protocolNamespaceThe namespace.

已在 GCKGenericChannel 中实现。

- (void) didReceiveTextMessage: (NSString *)  message

当在此渠道上收到短信时调用。

默认实现是一种空操作。

Parameters
messageThe message.
- (BOOL) sendTextMessage: (NSString *)  message

在此渠道上发送短信。

Parameters
messageThe message.
返回
成功时为
YES,如果无法发送消息(因为渠道未连接,或者因为发送缓冲区目前过于拥挤),则为 NO
Deprecated:
使用 sendTextMessage:error:,该方法可提供详细的错误信息。
- (BOOL) sendTextMessage: (NSString *)  message
error: (GCKError *__nullable *__nullable)  error 

在此渠道上发送短信。

Parameters
messageThe message.
errorA pointer at which to store the error result. May be nil.
返回
成功时为
YES,无法发送消息时为 NO
- (NSInteger) generateRequestID

为新消息生成请求 ID。

返回
生成的 ID;如果渠道当前未连接,则为 kGCKInvalidRequestID
- (NSNumber * __nullable) generateRequestNumber

一种便捷方法,用于将 generateRequestID 的结果封装在 NSNumber 中。

返回
生成的 ID;如果渠道当前未连接,则为 nil
- (void) didConnect

当此渠道已连接时调用,表示现在可以通过此渠道与 Cast 设备交换消息。

默认实现是一种空操作。

- (void) didDisconnect

当此渠道已断开连接时调用,表示无法再通过此渠道与 Cast 设备交换消息。

默认实现是一种空操作。

媒体资源详情

- (GCKMediaStatus*) mediaStatus
readnonatomicstrong

当前加载的媒体的媒体状态(如果有);否则为 nil

- (NSTimeInterval) timeSinceLastMediaStatusUpdate
readnonatomicassign

自上次收到媒体状态更新以来经过的时间。

如果状态请求目前正在进行中,则此值为 0。

- (GCKError*) lastError
readnonatomiccopy

上次请求的错误详情(如有),如果上次请求成功,则为 nil

- (id<GCKMediaControlChannelDelegate>) delegate
readwritenonatomicweak

用于接收有关渠道状态变化的通知的委托。

- (NSString*) protocolNamespace
readnonatomiccopyinherited

渠道的命名空间。

- (BOOL) isConnected
readnonatomicassigninherited

一个标志,用于指示相应渠道当前是否已连接。

- (GCKDeviceManager*) deviceManager
readnonatomicweakinherited

相应渠道注册到的设备管理器(如果有)。

Deprecated:
如果此渠道未注册到已弃用的 GCKDeviceManager 类,则此值为 nil