Showing content from https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_remote_media_client below:
GCKRemoteMediaClient Class | Cast | Google for Developers
Skip to main content GCKRemoteMediaClient Class
Stay organized with collections Save and categorize content based on your preferences.
A class for controlling media playback on a Cast receiver.
An instance of this object is available as the property GCKSession::remoteMediaClient.
-
Since
-
3.0
Inherits NSObject.
Adds a listener to this object's list of listeners.
The added listener is weakly held, and should be retained to avoid unexpected deallocation.
-
Parameters
-
listener The listener to add.
Removes a listener from this object's list of listeners.
-
Parameters
-
listener The listener to remove.
Loads and starts playback of a media item or a queue of media items with a request data.
-
Parameters
-
requestData Describes the media load request.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.4.1
Loads and starts playback of a new media item with default options.
It is recommended to use loadMediaWithLoadRequestData: instead, which is an advanced load command supporting loading a single item or a queue with additional options.
-
Parameters
-
mediaInfo Describes the media item to load.
-
Returns
-
The GCKRequest object for tracking this request.
Loads and starts playback of a new media item with the specified options.
It is recommended to use loadMediaWithLoadRequestData: instead, which is an advanced load command supporting loading a single item or a queue with additional options.
-
Parameters
-
mediaInfo Describes the media item to load. options The load options for this request.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.0
Loads and optionally starts playback of a new media item.
-
Parameters
-
mediaInfo Describes the media item to load. autoplay Whether playback should start immediately.
-
Returns
-
The GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
Loads and optionally starts playback of a new media item.
-
Parameters
-
mediaInfo Describes the media item to load. autoplay Whether playback should start immediately. playPosition The initial playback position.
-
Returns
-
The GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
Loads and optionally starts playback of a new media item.
-
Parameters
-
mediaInfo Describes 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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
- (GCKRequest *) loadMedia: (GCKMediaInformation *) mediaInfo autoplay: (BOOL) autoplay playPosition: (NSTimeInterval) playPosition activeTrackIDs: (nullable NSArray< NSNumber * > *) activeTrackIDs
Loads and optionally starts playback of a new media item.
-
Parameters
-
mediaInfo Describes 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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
- (GCKRequest *) loadMedia: (GCKMediaInformation *) mediaInfo autoplay: (BOOL) autoplay playPosition: (NSTimeInterval) playPosition activeTrackIDs: (nullable NSArray< NSNumber * > *) activeTrackIDs customData: (nullable id) customData
Loads and optionally starts playback of a new media item.
-
Parameters
-
mediaInfo Describes 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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
- (GCKRequest *) setPlaybackRate: (float) playbackRate
Sets the playback rate for the current media session.
-
Parameters
-
playbackRate The new playback rate.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.0
Sets the playback rate for the current media session.
-
Parameters
-
playbackRate The new playback rate, which must be between GCKMediaLoadOptions::kGCKMediaMinPlaybackRate and GCKMediaLoadOptions::kGCKMediaMaxPlaybackRate. 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 GCKRequest object for tracking this request.
-
Since
-
4.0
- (GCKRequest *) setActiveTrackIDs: (nullable NSArray< NSNumber * > *) activeTrackIDs
Sets the active tracks.
The request will fail if there is no current media status.
-
Parameters
-
activeTrackIDs An array of integers specifying the active tracks. May be empty or
nil
to disable any currently active tracks.
-
Returns
-
The GCKRequest object for tracking this request.
Sets the text track style.
The 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 GCKRequest object for tracking this request.
Pauses playback of the current media item.
The request will fail if there is no current media status.
-
Returns
-
The GCKRequest object for tracking this request.
- (GCKRequest *) pauseWithCustomData: (nullable id) customData
Pauses playback of the current media item.
The 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 GCKRequest object for tracking this request.
Stops playback of the current media item.
If a queue is currently loaded, it will be removed. The request will fail if there is no current media status.
-
Returns
-
The GCKRequest object for tracking this request.
- (GCKRequest *) stopWithCustomData: (nullable id) customData
Stops playback of the current media item.
If a queue is currently loaded, it will be removed. The 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 GCKRequest object for tracking this request.
Begins (or resumes) playback of the current media item.
Playback always begins at the beginning of the stream. The request will fail if there is no current media status.
-
Returns
-
The GCKRequest object for tracking this request.
- (GCKRequest *) playWithCustomData: (nullable id) customData
Begins (or resumes) playback of the current media item.
Playback always begins at the beginning of the stream. The 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 GCKRequest object for tracking this request.
Sends a request to skip the playing ad.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.3
Seeks to a new position within the current media item.
The request will fail if there is no current media status.
-
Parameters
-
options The seek options for the request.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.0
- (GCKRequest *) seekToTimeInterval: (NSTimeInterval) position
Seeks to a new position within the current media item.
The request will fail if there is no current media status.
-
Parameters
-
position The new position from the beginning of the stream.
-
Returns
-
The GCKRequest object for tracking this request.
-
Deprecated:
-
Use seekWithOptions:.
Seeks to a new position within the current media item.
The 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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use seekWithOptions:.
- (GCKRequest *) seekToTimeInterval: (NSTimeInterval) position resumeState: (GCKMediaResumeState) resumeState customData: (nullable id) customData
Seeks to a new position within the current media item.
The 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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use seekWithOptions:.
Requests the list of item IDs for the queue.
The results are passed to the delegate callback GCKRemoteMediaClientDelegate::remoteMediaClient:didReceiveQueueItemIDs:.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.1
- (GCKRequest *) queueFetchItemsForIDs: (NSArray< NSNumber * > *) queueItemIDs
Requests complete information for the queue items with the given item IDs.
The results are passed to the delegate callback GCKRemoteMediaClientDelegate::remoteMediaClient:didReceiveQueueItems:.
-
Returns
-
The GCKRequest object for tracking this request.
-
Since
-
4.1
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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
- (GCKRequest *) queueLoadItems: (NSArray< GCKMediaQueueItem * > *) queueItems startIndex: (NSUInteger) startIndex playPosition: (NSTimeInterval) playPosition repeatMode: (GCKMediaRepeatMode) repeatMode customData: (nullable id) 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 GCKRequest object for tracking this request.
-
Deprecated:
-
Use loadMediaWithLoadRequestData:.
Loads and optionally starts playback of a new queue of media items.
It is recommended to use loadMediaWithLoadRequestData: instead, which is an advanced load command supporting loading a single item or a queue with additional options.
-
Parameters
-
-
Since
-
4.3.1
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 GCKRequest object for tracking this request.
- (GCKRequest *) queueInsertItems: (NSArray< GCKMediaQueueItem * > *) queueItems beforeItemWithID: (NSUInteger) beforeItemID customData: (nullable id) 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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
- (GCKRequest *) queueInsertAndPlayItem: (GCKMediaQueueItem *) item beforeItemWithID: (NSUInteger) beforeItemID playPosition: (NSTimeInterval) playPosition customData: (nullable id) 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 GCKRequest object for tracking this request.
Updates the queue.
-
Parameters
-
queueItems The list of updated items.
-
Returns
-
The GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
- (GCKRequest *) 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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
- (GCKRequest *) 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 GCKRequest object for tracking this request.
- (GCKRequest *) 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 GCKRequest object for tracking this request.
- (GCKRequest *) queueReorderItemsWithIDs: (NSArray< NSNumber * > *) queueItemIDs insertBeforeItemWithID: (NSUInteger) beforeItemID customData: (nullable id) 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 GCKRequest object for tracking this request.
- (GCKRequest *) 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 GCKRequest object for tracking this request.
- (GCKRequest *) 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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
Moves to the next item in the queue.
-
Returns
-
The GCKRequest object for tracking this request.
Moves to the previous item in the queue.
-
Returns
-
The GCKRequest object for tracking this request.
Sets the queue repeat mode.
-
Parameters
-
repeatMode The new repeat mode.
-
Returns
-
The GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
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 GCKRequest object for tracking this request.
Requests updated media status information from the receiver.
-
Returns
-
The GCKRequest object for tracking this request.
- (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.
- (NSTimeInterval) approximateLiveSeekableRangeStart
Returns the approximate start position of seekable range 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. Returns kGCKInvalidTimeInterval
if the stream is not live stream or there is no seekable range.
-
Since
-
4.4.1
- (NSTimeInterval) approximateLiveSeekableRangeEnd
Returns the approximate end position of seekable range 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. Returns kGCKInvalidTimeInterval
if the stream is not live stream or there is no seekable range.
-
Since
-
4.4.1
- (void) notifyDidStartMediaSession
To be called by subclasses whenever a media session begins, namely, right after new media has been successfully loaded on the remote player.
Provided by category GCKRemoteMediaClient(Protected).
- (void) notifyDidUpdateMediaStatus - (void) notifyDidUpdateQueue - (void) notifyDidUpdatePreloadStatus - (void) notifyDidUpdateMetadata - (void) notifyDidReceiveQueueItemIDs: (NSArray< NSNumber * > *) itemIDs
To be called by subclasses whenever the list of media queue item IDs is received.
-
Parameters
-
itemIDs The list of queue item IDs.
-
Since
-
4.1
Provided by category GCKRemoteMediaClient(Protected).
- (void) notifyDidInsertQueueItemsWithIDs: (NSArray< NSNumber * > *) itemIDs beforeItemWithID: (GCKMediaQueueItemID) beforeItemID
To be called by subclasses whenever a contiguous sequence of queue items has been inserted into the queue.
-
Parameters
-
itemIDs The list of queue item IDs identifying the items that were inserted. beforeItemID The ID of the queue item in front of which the new items were inserted, or kGCKInvalidQueueItemID if the items were appended to the end of the queue.
-
Since
-
4.1
Provided by category GCKRemoteMediaClient(Protected).
- (void) notifyDidUpdateQueueItemsWithIDs: (NSArray< NSNumber * > *) itemIDs
To be called by subclasses whenever existing queue items have been updated in the queue.
-
Parameters
-
itemIDs The list of queue item IDs identifying the items that were updated.
-
Since
-
4.1
Provided by category GCKRemoteMediaClient(Protected).
- (void) notifyDidRemoveQueueItemsWithIDs: (NSArray< NSNumber * > *) itemIDs
To be called by subclasses whenever a contiguous sequence of queue items has been removed from the queue.
-
Parameters
-
itemIDs The list of queue item IDs identifying the items that were removed.
-
Since
-
4.1
Provided by category GCKRemoteMediaClient(Protected).
To be called by a subclass whenever queue items have been received.
-
Parameters
-
items The list of queue items.
-
Since
-
4.1
Provided by category GCKRemoteMediaClient(Protected).
A flag that indicates whether this object is connected to a session.
The current media status, as reported by the media control channel.
The media queue.
-
Since
-
4.3.4
- (NSTimeInterval) timeSinceLastMediaStatusUpdate readnonatomicassign
The amount of time that has passed since the last media status update was received.
If a media status has not been received yet this value will be NAN.
- (BOOL) playingLiveStream readnonatomicassign
A flag that indicates whether this client is playing a live stream.
-
Since
-
4.4.1
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `GCKRemoteMediaClient` class is the primary interface for controlling media playback on a Google Cast receiver."],["It provides methods for loading media, managing playback (play, pause, seek), and handling media queues."],["Developers can monitor playback status, receive events, and control stream volume and mute state."],["Properties like `mediaStatus`, `mediaQueue`, and `playingLiveStream` offer insights into the current playback environment."],["It empowers developers to create comprehensive and interactive media experiences within their Cast-enabled applications."]]],[]]
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4