GCKMediaQueueItem 类

GCKMediaQueueItem 类参考

概览

表示媒体队列项的类。

此对象的实例是不可变的。

此类用于发送方应用和接收方应用之间的双向通信。发送方构建这些命令,以在接收方应用上加载或插入媒体内容列表。接收方的 GCKMediaStatus 还包含表示为该类实例的商品列表。

加载后,接收器会为每个 GCKMediaQueueItem 分配一个唯一的商品 ID,即使同一媒体加载了多次也是如此。

继承自 NSObject。实现 <NSCopying>。

实例方法摘要

(instancetype) - initWithMediaInformation:autoplay:startTime:preloadTime:activeTrackIDs:customData:
 使用给定的属性构造新的 GCKMediaQueueItem更多…
 
(instancetype) - initWithMediaInformation:autoplay:startTime:playbackDuration:preloadTime:activeTrackIDs:customData:
 指定初始化程序。更多…
 
(void) - clearItemID
 清除(取消分配)商品 ID。更多…
 
(instancetype) - mediaQueueItemModifiedWithBlock:
 返回已由给定块修改的此 GCKMediaQueueItem 的副本。更多…
 

房源摘要

GCKMediaInformationmediaInformation
 与相应媒体项相关联的媒体信息。更多…
 
NSUInteger itemID
 商品 ID,如果尚未分配,则为 kGCKMediaQueueInvalidItemID更多…
 
BOOL autoplay
 当相应项成为队列中的当前项时,是否应自动开始播放。更多…
 
NSTimeInterval startTime
 相应商品的开始时间(以秒为单位)。更多…
 
NSTimeInterval playbackDuration
 相应项的播放时长(以秒为单位),如果应使用视频流的实际时长,则为 INFINITY更多…
 
NSTimeInterval preloadTime
 接收器应在上一项内容结束前多久(以秒为单位)开始预加载此项内容。更多…
 
NSArray< NSNumber * > * activeTrackIDs
 相应媒体文件的有效轨道 ID。更多…
 
id customData
 与相应商品相关联的自定义数据(如果有)。更多…
 

方法详细信息

- (instancetype) initWithMediaInformation: (GCKMediaInformation *)  mediaInformation
autoplay: (BOOL)  autoplay
startTime: (NSTimeInterval)  startTime
preloadTime: (NSTimeInterval)  preloadTime
activeTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs
customData: (id __nullable)  customData 

使用给定的属性构造新的 GCKMediaQueueItem

如需了解详情,请参阅相应属性的文档。

Parameters
mediaInformationThe media information for the item.
autoplayThe autoplay state for this item.
startTimeThe start time of the item, in seconds. May be kGCKInvalidTimeInterval if this item refers to a live stream or if the default start time should be used.
preloadTimeThe preload time for the item, in seconds. May be kGCKInvalidTimeInterval to indicate no preload time.
activeTrackIDsThe active track IDs for the item. May be nil.
customDataAny custom data to associate with the item. May be nil.
- (instancetype) initWithMediaInformation: (GCKMediaInformation *)  mediaInformation
autoplay: (BOOL)  autoplay
startTime: (NSTimeInterval)  startTime
playbackDuration: (NSTimeInterval)  playbackDuration
preloadTime: (NSTimeInterval)  preloadTime
activeTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs
customData: (id __nullable)  customData 

指定初始化程序。

使用给定的属性构造新的 GCKMediaQueueItem。如需了解详情,请参阅相应属性的文档。

Parameters
mediaInformationThe media information for the item.
autoplayThe autoplay state for this item.
startTimeThe start time of the item, in seconds. May be kGCKInvalidTimeInterval if this item refers to a live stream or if the default start time should be used.
playbackDurationThe playback duration of the item, in seconds. May be kGCKInvalidTimeInterval to indicate no preload time.
preloadTimeThe preload time for the item, in seconds.
activeTrackIDsThe active track IDs for the item. May be nil.
customDataAny custom data to associate with the item. May be nil.
- (void) clearItemID

清除(取消分配)商品 ID。

应调用此方法以重用现有实例,例如将其重新添加到队列中。

- (instancetype) mediaQueueItemModifiedWithBlock: (void(^)(GCKMediaQueueItemBuilder *builder))  block

返回已通过给定块修改的此 GCKMediaQueueItem 的副本。

Parameters
blockA block that receives a GCKMediaQueueItemBuilder which can be used to modify attributes of the copy. It is not necessary to call the builder's build (GCKMediaQueueItemBuilder) method within the block, as this method will do that automatically when the block completes.
返回
相应商品的修改后副本。

媒体资源详情

- (GCKMediaInformation*) mediaInformation
readnonatomicstrong

与相应媒体项相关联的媒体信息。

- (NSUInteger) itemID
readnonatomicassign

商品 ID,如果尚未分配,则为 kGCKMediaQueueInvalidItemID

- (BOOL) autoplay
readnonatomicassign

当相应项成为队列中的当前项时,是否应自动开始播放。

如果值为 NO,则队列在到达此项时会暂停。默认值为 YES

- (NSTimeInterval) startTime
readnonatomicassign

相应商品的开始时间(以秒为单位)。

默认值为 kGCKInvalidTimeInterval,表示尚未设置开始时间。

- (NSTimeInterval) playbackDuration
readnonatomicassign

相应项的播放时长(以秒为单位),如果应使用视频流的实际时长,则为 INFINITY

- (NSTimeInterval) preloadTime
readnonatomicassign

接收器应在上一项内容结束前多久(以秒为单位)开始预加载此项内容。

默认值为 kGCKInvalidTimeInterval,表示未设置预加载时间。

- (NSArray<NSNumber *>*) activeTrackIDs
readnonatomicstrong

相应商品的有效轨道 ID。

- (id) customData
readnonatomicstrong

与相应商品相关联的自定义数据(如果有)。