GCKMediaQueueItem Class

GCKMediaQueueItem Class Reference

Overview

A class representing a media queue item.

Instances of this object are immutable.

This class is used in two-way communication between a sender application and a receiver application. The sender constructs them to load or insert a list of media items on the receiver application. The GCKMediaStatus from the receiver also contains the list of items represented as instances of this class.

Once loaded, the receiver will assign a unique item ID to each GCKMediaQueueItem, even if the same media gets loaded multiple times.

Inherits NSObject. Implements <NSCopying>.

Instance Method Summary

(instancetype) - initWithMediaInformation:autoplay:startTime:preloadTime:activeTrackIDs:customData:
 Constructs a new GCKMediaQueueItem with the given attributes. More...
 
(instancetype) - initWithMediaInformation:autoplay:startTime:playbackDuration:preloadTime:activeTrackIDs:customData:
 Designated initializer. More...
 
(void) - clearItemID
 Clears (unassigns) the item ID. More...
 
(instancetype) - mediaQueueItemModifiedWithBlock:
 Returns a copy of this GCKMediaQueueItem that has been modified by the given block. More...
 

Property Summary

GCKMediaInformationmediaInformation
 The media information associated with this item. More...
 
GCKMediaQueueItemID itemID
 The item ID, or kGCKMediaQueueInvalidItemID if one has not yet been assigned. More...
 
BOOL autoplay
 Whether the item should automatically start playback when it becomes the current item in the queue. More...
 
NSTimeInterval startTime
 The start time of the item, in seconds. More...
 
NSTimeInterval playbackDuration
 The playback duration for the item, in seconds, or INFINITY if the stream's actual duration should be used. More...
 
NSTimeInterval preloadTime
 How long before the previous item ends, in seconds, before the receiver should start preloading this item. More...
 
NSArray< NSNumber * > * activeTrackIDs
 The active track IDs for this item. More...
 
id customData
 The custom data associated with this item, if any. More...
 

Method Detail

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

Constructs a new GCKMediaQueueItem with the given attributes.

See the documentation of the corresponding properties for more information.

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: (nullable NSArray< NSNumber * > *)  activeTrackIDs
customData: (nullable id)  customData 

Designated initializer.

Constructs a new GCKMediaQueueItem with the given attributes. See the documentation of the corresponding properties for more information.

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

Clears (unassigns) the item ID.

Should be called in order to reuse an existing instance, for example, to add it back to a queue.

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

Returns a copy of this GCKMediaQueueItem that has been modified by the given block.

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.
Returns
A modified copy of this item.

Property Detail

- (GCKMediaInformation*) mediaInformation
readnonatomicstrong

The media information associated with this item.

- (GCKMediaQueueItemID) itemID
readnonatomicassign

The item ID, or kGCKMediaQueueInvalidItemID if one has not yet been assigned.

- (BOOL) autoplay
readnonatomicassign

Whether the item should automatically start playback when it becomes the current item in the queue.

If NO, the queue will pause when it reaches this item. The default value is YES. When using this item to load a media queue in GCKMediaLoadRequestData, this property in the first item only takes effect if autoplay in GCKMediaLoadRequestData is nil.

- (NSTimeInterval) startTime
readnonatomicassign

The start time of the item, in seconds.

The default value is kGCKInvalidTimeInterval, indicating that no start time has been set.

- (NSTimeInterval) playbackDuration
readnonatomicassign

The playback duration for the item, in seconds, or INFINITY if the stream's actual duration should be used.

- (NSTimeInterval) preloadTime
readnonatomicassign

How long before the previous item ends, in seconds, before the receiver should start preloading this item.

The default value is kGCKInvalidTimeInterval, indicating that no preload time has been set.

- (NSArray<NSNumber *>*) activeTrackIDs
readnonatomicstrong

The active track IDs for this item.

- (id) customData
readnonatomicstrong

The custom data associated with this item, if any.