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) 
Loads and starts playback of a new media item. More...
(NSInteger) 
Loads and optionally starts playback of a new media item. More...
Loads and optionally starts playback of a new media item. More...
Loads and optionally starts playback of a new media item. More...
Loads and optionally starts playback of a new media item. More...
Loads and optionally starts playback of a new media item. More...
(NSInteger) 
Sets the active tracks. More...
(NSInteger) 
Sets the text track style. More...
(NSInteger) 
Pauses playback of the current media item. More...
(NSInteger) 
Pauses playback of the current media item. More...
(NSInteger) 
- stop
Stops playback of the current media item. More...
(NSInteger) 
Stops playback of the current media item. More...
(NSInteger) 
- play
Begins (or resumes) playback of the current media item. More...
(NSInteger) 
Begins (or resumes) playback of the current media item. More...
(NSInteger) 
Seeks to a new position within the current media item. More...
Seeks to a new position within the current media item. More...
Seeks to a new position within the current media item. More...
Loads and optionally starts playback of a new queue of media items. More...
Loads and optionally starts playback of a new queue of media items. More...
Loads and optionally starts playback of a new queue of media items. More...
Inserts a list of new media items into the queue. More...
Inserts a list of new media items into the queue. More...
A convenience method that inserts a single item into the queue. More...
A convenience method that inserts a single item into the queue and makes it the current item. More...
A convenience method that inserts a single item into the queue and makes it the current item. More...
(NSInteger) 
Updates the queue. More...
Updates the queue. More...
(NSInteger) 
Removes a list of media items from the queue. More...
Removes a list of media items from the queue. More...
(NSInteger) 
A convenience method that removes a single item from the queue. More...
Reorders a list of media items in the queue. More...
Reorder a list of media items in the queue. More...
A convenience method that moves a single item in the queue. More...
(NSInteger) 
Jumps to the item with the specified ID in the queue. More...
Jumps to the item with the specified ID in the queue. More...
Jumps to the item with the specified ID in the queue. More...
(NSInteger) 
Moves to the next item in the queue. More...
(NSInteger) 
Moves to the previous item in the queue. More...
(NSInteger) 
Sets the queue repeat mode. More...
(NSInteger) 
Sets the stream volume. More...
(NSInteger) 
Sets the stream volume. More...
(NSInteger) 
Sets whether the stream is muted. More...
(NSInteger) 
Sets whether the stream is muted. More...
(NSInteger) 
Requests updated media status information from the receiver. More...
(NSTimeInterval) 
Returns the approximate stream position as calculated from the last received stream information and the elapsed wall-time since that update. More...
Cancels an in-progress request. More...
(instancetype) 
Designated initializer. More...
Called when a text message has been received on this channel. More...
(BOOL) 
Sends a text message on this channel. More...
Sends a text message on this channel. More...
(NSInteger) 
Generates a request ID for a new message. More...
(NSNumber *__nullable) 
A convenience method which wraps the result of generateRequestID in an NSNumber . More...
(void) 
Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel. More...
(void) 
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

The media status for the currently loaded media, if any; otherwise nil . More...
The amount of time that has passed since the last media status update was received. More...
The error detail from the last request, if any, or nil if the last request was successful. More...
The delegate for receiving notifications about changes in the channel's state. More...
NSString * 
The channel's namespace. More...
BOOL 
A flag indicating whether this channel is currently connected. More...
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
mediaInfo
An 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
mediaInfo An object describing the media item to load.
autoplay Whether 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
mediaInfo An object describing the media item to load.
autoplay Whether playback should start immediately.
playPosition The 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
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 .
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
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 .
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
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 .
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
activeTrackIDs
An 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
textTrackStyle
The 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
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 .
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
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 .
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
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 .
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
position
The 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
position The new position interval from the beginning of the stream.
resumeState The 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
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 .
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
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.
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
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 .
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
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 .
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
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.
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
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 .
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
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.
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
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.
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
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 .
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
queueItems
The 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
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 .
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
itemIDs
An 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
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 .
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
itemID
The 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
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.
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
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 .
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
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.
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
itemID
The 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
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 .
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
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 .
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
repeatMode
The 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
volume
The 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
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 .
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
muted
Whether 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
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 .
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
requestID
The 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
protocolNamespace
The 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
message
The message.
- (BOOL) sendTextMessage: (NSString *)  message

Sends a text message on this channel.

Parameters
message
The 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
message The message.
error A 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
read nonatomic strong

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

- (NSTimeInterval) timeSinceLastMediaStatusUpdate
read nonatomic assign

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
read nonatomic copy

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

read write nonatomic weak

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

- (NSString*) protocolNamespace
read nonatomic copy inherited

The channel's namespace.

- (BOOL) isConnected
read nonatomic assign inherited

A flag indicating whether this channel is currently connected.

- ( GCKDeviceManager *) deviceManager
read nonatomic weak inherited

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 .
Create a Mobile Website
View Site in Mobile | Classic
Share by: