GCKMediaControlChannel Class

GCKMediaControlChannel Class Reference

Overview

A GCKCastChannel subclass for media control operations.

Any operations which apply to a currently active stream (play, pause, seek, stop, etc.) require a valid (that is, non-nil) media status, or they will return kGCKInvalidRequestID and will not send the request. A media status is requested automatically when the channel connects, is included with a successful load completed respose, and can also be updated at any time. The media status can also become nil at any time; this will happen if the channel is temporarily disconnected, for example. When using this channel, media status changes should be monitored via the mediaControlChannelDidUpdateStatus: (GCKMediaControlChannelDelegate-p) callback, and methods which act on streams should be called only while the media status is non-nil.

If a request is successfully started, the corresponding method returns the request ID that was assigned to that request. If the request fails to start, the method returns kGCKInvalidRequestID and sets the lastError property to indicate the reason for the failure. If a request is successfully started but ultimately fails, the mediaControlChannel:requestDidFailWithID:error: (GCKMediaControlChannelDelegate-p) callback will be invoked to indicate the failure.

See GCKMediaControlChannelDelegate for the delegate protocol.

Deprecated:
Use the GCKRemoteMediaClient property of the GCKCastSession to control media playback.

Inherits GCKCastChannel.

Instance Method Summary

(instancetype) - init
 Designated initializer. More...
 
(NSInteger) - loadMedia:
 Loads and starts playback of a new media item. More...
 
(NSInteger) - loadMedia:autoplay:
 Loads and optionally starts playback of a new media item. More...
 
(NSInteger) - loadMedia:autoplay:playPosition:
 Loads and optionally starts playback of a new media item. More...
 
(NSInteger) - loadMedia:autoplay:playPosition:customData:
 Loads and optionally starts playback of a new media item. More...
 
(NSInteger) - loadMedia:autoplay:playPosition:activeTrackIDs:
 Loads and optionally starts playback of a new media item. More...
 
(NSInteger) - loadMedia:autoplay:playPosition:activeTrackIDs:customData:
 Loads and optionally starts playback of a new media item. More...
 
(NSInteger) - setActiveTrackIDs:
 Sets the active tracks. More...
 
(NSInteger) - setTextTrackStyle:
 Sets the text track style. More...
 
(NSInteger) - pause
 Pauses playback of the current media item. More...
 
(NSInteger) - pauseWithCustomData:
 Pauses playback of the current media item. More...
 
(NSInteger) - stop
 Stops playback of the current media item. More...
 
(NSInteger) - stopWithCustomData:
 Stops playback of the current media item. More...
 
(NSInteger) - play
 Begins (or resumes) playback of the current media item. More...
 
(NSInteger) - playWithCustomData:
 Begins (or resumes) playback of the current media item. More...
 
(NSInteger) - seekToTimeInterval:
 Seeks to a new position within the current media item. More...
 
(NSInteger) - seekToTimeInterval:resumeState:
 Seeks to a new position within the current media item. More...
 
(NSInteger) - seekToTimeInterval:resumeState:customData:
 Seeks to a new position within the current media item. More...
 
(NSInteger) - queueLoadItems:startIndex:repeatMode:
 Loads and optionally starts playback of a new queue of media items. More...
 
(NSInteger) - queueLoadItems:startIndex:repeatMode:customData:
 Loads and optionally starts playback of a new queue of media items. More...
 
(NSInteger) - queueLoadItems:startIndex:playPosition:repeatMode:customData:
 Loads and optionally starts playback of a new queue of media items. More...
 
(NSInteger) - queueInsertItems:beforeItemWithID:
 Inserts a list of new media items into the queue. More...
 
(NSInteger) - queueInsertItems:beforeItemWithID:customData:
 Inserts a list of new media items into the queue. More...
 
(NSInteger) - queueInsertItem:beforeItemWithID:
 A convenience method that inserts a single item into the queue. More...
 
(NSInteger) - queueInsertAndPlayItem:beforeItemWithID:
 A convenience method that inserts a single item into the queue and makes it the current item. More...
 
(NSInteger) - queueInsertAndPlayItem:beforeItemWithID:playPosition:customData:
 A convenience method that inserts a single item into the queue and makes it the current item. More...
 
(NSInteger) - queueUpdateItems:
 Updates the queue. More...
 
(NSInteger) - queueUpdateItems:customData:
 Updates the queue. More...
 
(NSInteger) - queueRemoveItemsWithIDs:
 Removes a list of media items from the queue. More...
 
(NSInteger) - queueRemoveItemsWithIDs:customData:
 Removes a list of media items from the queue. More...
 
(NSInteger) - queueRemoveItemWithID:
 A convenience method that removes a single item from the queue. More...
 
(NSInteger) - queueReorderItemsWithIDs:insertBeforeItemWithID:
 Reorders a list of media items in the queue. More...
 
(NSInteger) - queueReorderItemsWithIDs:insertBeforeItemWithID:customData:
 Reorder a list of media items in the queue. More...
 
(NSInteger) - queueMoveItemWithID:beforeItemWithID:
 A convenience method that moves a single item in the queue. More...
 
(NSInteger) - queueJumpToItemWithID:
 Jumps to the item with the specified ID in the queue. More...
 
(NSInteger) - queueJumpToItemWithID:customData:
 Jumps to the item with the specified ID in the queue. More...
 
(NSInteger) - queueJumpToItemWithID:playPosition:customData:
 Jumps to the item with the specified ID in the queue. More...
 
(NSInteger) - queueNextItem
 Moves to the next item in the queue. More...
 
(NSInteger) - queuePreviousItem
 Moves to the previous item in the queue. More...
 
(NSInteger) - queueSetRepeatMode:
 Sets the queue repeat mode. More...
 
(NSInteger) - setStreamVolume:
 Sets the stream volume. More...
 
(NSInteger) - setStreamVolume:customData:
 Sets the stream volume. More...
 
(NSInteger) - setStreamMuted:
 Sets whether the stream is muted. More...
 
(NSInteger) - setStreamMuted:customData:
 Sets whether the stream is muted. More...
 
(NSInteger) - requestStatus
 Requests updated media status information from the receiver. More...
 
(NSTimeInterval) - approximateStreamPosition
 Returns the approximate stream position as calculated from the last received stream information and the elapsed wall-time since that update. More...
 
(BOOL) - cancelRequestWithID:
 Cancels an in-progress request. More...
 
(instancetype) - initWithNamespace:
 Designated initializer. More...
 
(void) - didReceiveTextMessage:
 Called when a text message has been received on this channel. More...
 
(BOOL) - sendTextMessage:
 Sends a text message on this channel. More...
 
(BOOL) - sendTextMessage:error:
 Sends a text message on this channel. More...
 
(NSInteger) - generateRequestID
 Generates a request ID for a new message. More...
 
(NSNumber *__nullable) - generateRequestNumber
 A convenience method which wraps the result of generateRequestID in an NSNumber. More...
 
(void) - didConnect
 Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel. More...
 
(void) - didDisconnect
 Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel. More...
 

Property Summary

GCKMediaStatusmediaStatus
 The media status for the currently loaded media, if any; otherwise nil. More...
 
NSTimeInterval timeSinceLastMediaStatusUpdate
 The amount of time that has passed since the last media status update was received. More...
 
GCKErrorlastError
 The error detail from the last request, if any, or nil if the last request was successful. More...
 
id< GCKMediaControlChannelDelegatedelegate
 The delegate for receiving notifications about changes in the channel's state. More...
 
NSString * protocolNamespace
 The channel's namespace. More...
 
BOOL isConnected
 A flag indicating whether this channel is currently connected. More...
 
GCKDeviceManagerdeviceManager
 The device manager with which this channel is registered, if any. More...
 

Method Detail

- (instancetype) init

Designated initializer.

Implements GCKCastChannel.

- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo

Loads and starts playback of a new media item.

Parameters
mediaInfoAn object describing the media item to load.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay 

Loads and optionally starts playback of a new media item.

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition 

Loads and optionally starts playback of a new media item.

Parameters
mediaInfoAn object describing the media item to load.
autoplayWhether playback should start immediately.
playPositionThe initial playback position.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition
customData: (id __nullable)  customData 

Loads and optionally starts playback of a new media item.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition
activeTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs 

Loads and optionally starts playback of a new media item.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) loadMedia: (GCKMediaInformation *)  mediaInfo
autoplay: (BOOL)  autoplay
playPosition: (NSTimeInterval)  playPosition
activeTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs
customData: (id __nullable)  customData 

Loads and optionally starts playback of a new media item.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) setActiveTrackIDs: (NSArray< NSNumber * > *__nullable)  activeTrackIDs

Sets the active tracks.

Request will fail if there is no current media status.

Parameters
activeTrackIDsAn array of integers specifying the active tracks.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent. May be nil or an empty array to set the active tracks to the empty list.
- (NSInteger) setTextTrackStyle: (GCKMediaTextTrackStyle *__nullable)  textTrackStyle

Sets the text track style.

Request will fail if there is no current media status.

Parameters
textTrackStyleThe text track style. The style will not be changed if this is nil.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) pause

Pauses playback of the current media item.

Request will fail if there is no current media status.

Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) pauseWithCustomData: (id __nullable)  customData

Pauses playback of the current media item.

Request will fail if there is no current media status.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) stop

Stops playback of the current media item.

Request will fail if there is no current media status. If a queue is currently loaded, it is removed.

Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) stopWithCustomData: (id __nullable)  customData

Stops playback of the current media item.

Request will fail if there is no current media status. If a queue is currently loaded, it is removed.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) play

Begins (or resumes) playback of the current media item.

Playback always begins at the beginning of the stream. Request will fail if there is no current media status.

Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) playWithCustomData: (id __nullable)  customData

Begins (or resumes) playback of the current media item.

Playback always begins at the beginning of the stream. Request will fail if there is no current media status.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) seekToTimeInterval: (NSTimeInterval)  position

Seeks to a new position within the current media item.

Request will fail if there is no current media status.

Parameters
positionThe new position from the beginning of the stream.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) seekToTimeInterval: (NSTimeInterval)  position
resumeState: (GCKMediaControlChannelResumeState resumeState 

Seeks to a new position within the current media item.

Request will fail if there is no current media status.

Parameters
positionThe new position interval from the beginning of the stream.
resumeStateThe action to take after the seek operation has finished.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) seekToTimeInterval: (NSTimeInterval)  position
resumeState: (GCKMediaControlChannelResumeState resumeState
customData: (id __nullable)  customData 

Seeks to a new position within the current media item.

Request will fail if there is no current media status.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) queueLoadItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
startIndex: (NSUInteger)  startIndex
repeatMode: (GCKMediaRepeatMode repeatMode 

Loads and optionally starts playback of a new queue of media items.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueLoadItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
startIndex: (NSUInteger)  startIndex
repeatMode: (GCKMediaRepeatMode repeatMode
customData: (id __nullable)  customData 

Loads and optionally starts playback of a new queue of media items.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueLoadItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
startIndex: (NSUInteger)  startIndex
playPosition: (NSTimeInterval)  playPosition
repeatMode: (GCKMediaRepeatMode repeatMode
customData: (id __nullable)  customData 

Loads and optionally starts playback of a new queue of media items.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueInsertItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
beforeItemWithID: (NSUInteger)  beforeItemID 

Inserts a list of new media items into the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueInsertItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
beforeItemWithID: (NSUInteger)  beforeItemID
customData: (id __nullable)  customData 

Inserts a list of new media items into the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueInsertItem: (GCKMediaQueueItem *)  item
beforeItemWithID: (NSUInteger)  beforeItemID 

A convenience method that inserts a single item into the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueInsertAndPlayItem: (GCKMediaQueueItem *)  item
beforeItemWithID: (NSUInteger)  beforeItemID 

A convenience method that inserts a single item into the queue and makes it the current item.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueInsertAndPlayItem: (GCKMediaQueueItem *)  item
beforeItemWithID: (NSUInteger)  beforeItemID
playPosition: (NSTimeInterval)  playPosition
customData: (id __nullable)  customData 

A convenience method that inserts a single item into the queue and makes it the current item.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueUpdateItems: (NSArray< GCKMediaQueueItem * > *)  queueItems

Updates the queue.

Parameters
queueItemsThe list of updated items.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueUpdateItems: (NSArray< GCKMediaQueueItem * > *)  queueItems
customData: (id __nullable)  customData 

Updates the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueRemoveItemsWithIDs: (NSArray< NSNumber * > *)  itemIDs

Removes a list of media items from the queue.

If the queue becomes empty as a result, the current media session will be terminated.

Parameters
itemIDsAn array of media item IDs identifying the items to remove. Must not be nil or empty.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueRemoveItemsWithIDs: (NSArray< NSNumber * > *)  itemIDs
customData: (id __nullable)  customData 

Removes a list of media items from the queue.

If the queue becomes empty as a result, the current media session will be terminated.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueRemoveItemWithID: (NSUInteger)  itemID

A convenience method that removes a single item from the queue.

Parameters
itemIDThe ID of the item to remove.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueReorderItemsWithIDs: (NSArray< NSNumber * > *)  queueItemIDs
insertBeforeItemWithID: (NSUInteger)  beforeItemID 

Reorders a list of media items in the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueReorderItemsWithIDs: (NSArray< NSNumber * > *)  queueItemIDs
insertBeforeItemWithID: (NSUInteger)  beforeItemID
customData: (id __nullable)  customData 

Reorder a list of media items in the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueMoveItemWithID: (NSUInteger)  itemID
beforeItemWithID: (NSUInteger)  beforeItemID 

A convenience method that moves a single item in the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) queueJumpToItemWithID: (NSUInteger)  itemID

Jumps to the item with the specified ID in the queue.

Parameters
itemIDThe ID of the item to jump to.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) queueJumpToItemWithID: (NSUInteger)  itemID
customData: (id __nullable)  customData 

Jumps to the item with the specified ID in the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) queueJumpToItemWithID: (NSUInteger)  itemID
playPosition: (NSTimeInterval)  playPosition
customData: (id __nullable)  customData 

Jumps to the item with the specified ID in the queue.

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.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) queueNextItem

Moves to the next item in the queue.

Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) queuePreviousItem

Moves to the previous item in the queue.

Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) queueSetRepeatMode: (GCKMediaRepeatMode repeatMode

Sets the queue repeat mode.

Parameters
repeatModeThe new repeat mode.
Returns
The request ID for this request, or kGCKInvalidRequestID if the message could not be sent or if any of the parameters are invalid.
- (NSInteger) setStreamVolume: (float)  volume

Sets the stream volume.

The request will fail if there is no current media session.

Parameters
volumeThe new volume, in the range [0.0 - 1.0].
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) setStreamVolume: (float)  volume
customData: (id __nullable)  customData 

Sets the stream volume.

The request will fail if there is no current media session.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) setStreamMuted: (BOOL)  muted

Sets whether the stream is muted.

The request will fail if there is no current media session.

Parameters
mutedWhether the stream should be muted or unmuted.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) setStreamMuted: (BOOL)  muted
customData: (id __nullable)  customData 

Sets whether the stream is muted.

The request will fail if there is no current media session.

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.
Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSInteger) requestStatus

Requests updated media status information from the receiver.

Returns
The request ID, or kGCKInvalidRequestID if the message could not be sent.
- (NSTimeInterval) approximateStreamPosition

Returns the approximate stream position as calculated from the last received stream information and the elapsed wall-time since that update.

Returns 0 if the channel is not connected or if no media is currently loaded.

- (BOOL) cancelRequestWithID: (NSInteger)  requestID

Cancels an in-progress request.

Cancelling a request does not prevent it from being executed; it simply indicates that the calling application is no longer interested in the results of the request, so any state associated with the tracking of the request will be cleared.

Parameters
requestIDThe ID of the request to cancel.
Returns
YES if the request was cancelled, or NO if there is no request being tracked with the given ID.
- (instancetype) initWithNamespace: (NSString *)  protocolNamespace

Designated initializer.

Constructs a new GCKCastChannel with the given namespace.

Parameters
protocolNamespaceThe namespace.

Implemented in GCKGenericChannel.

- (void) didReceiveTextMessage: (NSString *)  message

Called when a text message has been received on this channel.

The default implementation is a no-op.

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

Sends a text message on this channel.

Parameters
messageThe message.
Returns
YES on success or NO if the message could not be sent (because the channel is not connected, or because the send buffer is too full at the moment).
Deprecated:
Use sendTextMessage:error: which provides detailed error information.
- (BOOL) sendTextMessage: (NSString *)  message
error: (GCKError *__nullable *__nullable)  error 

Sends a text message on this channel.

Parameters
messageThe message.
errorA pointer at which to store the error result. May be nil.
Returns
YES on success or NO if the message could not be sent.
- (NSInteger) generateRequestID

Generates a request ID for a new message.

Returns
The generated ID, or kGCKInvalidRequestID if the channel is not currently connected.
- (NSNumber * __nullable) generateRequestNumber

A convenience method which wraps the result of generateRequestID in an NSNumber.

Returns
The generated ID, or nil if the channel is not currently connected.
- (void) didConnect

Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel.

The default implementation is a no-op.

- (void) didDisconnect

Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel.

The default implementation is a no-op.

Property Detail

- (GCKMediaStatus*) mediaStatus
readnonatomicstrong

The media status for the currently loaded media, if any; otherwise nil.

- (NSTimeInterval) timeSinceLastMediaStatusUpdate
readnonatomicassign

The amount of time that has passed since the last media status update was received.

If a status request is currently in progress, this will be 0.

- (GCKError*) lastError
readnonatomiccopy

The error detail from the last request, if any, or nil if the last request was successful.

- (id<GCKMediaControlChannelDelegate>) delegate
readwritenonatomicweak

The delegate for receiving notifications about changes in the channel's state.

- (NSString*) protocolNamespace
readnonatomiccopyinherited

The channel's namespace.

- (BOOL) isConnected
readnonatomicassigninherited

A flag indicating whether this channel is currently connected.

- (GCKDeviceManager*) deviceManager
readnonatomicweakinherited

The device manager with which this channel is registered, if any.

Deprecated:
If this channel was not registered with the deprecated GCKDeviceManager class, this will be nil.

Send feedback about...