Overview
A controller for UI views that are used to control or display the status of media playback on a Cast receiver.
The calling application registers its media-related UI controls with the controller by setting the appropriate properties. The controller then responds to touch events on the controls by issuing the appropriate media commands to the receiver, and updates the controls based on status information and media metadata received from the receiver. The controller automatically enables and disables the UI controls as appropriate for the current session and media player state. It additionally disables all of the controls while a request is in progress.
See GCKUIMediaControllerDelegate for the delegate protocol.
- Since
- 3.0
Inherits NSObject.
Instance Method Summary | |
(instancetype) | - init |
Initializes an instance. More... | |
(void) | - bindLabel:toMetadataKey: |
Binds a UILabel to a metadata key. More... | |
(void) | - bindLabel:toMetadataKey:withFormatter: |
Binds a UILabel to a metadata key. More... | |
(void) | - bindTextView:toMetadataKey: |
Binds a UITextView to a metadata key. More... | |
(void) | - bindTextView:toMetadataKey:withFormatter: |
Binds a UITextView to a metadata key. More... | |
(void) | - bindImageView:toImageHints: |
Binds a UIImageView to a GCKUIImageHints instance. More... | |
(void) | - bindControlView:toRewindForTime: |
Binds a UIControl to rewind playback of the current item by the passed value as seconds. More... | |
(void) | - bindControlView:toForwardForTime: |
Binds a UIControl to forward playback of the current item by the passed value as seconds. More... | |
(void) | - unbindView: |
Unbinds the specified view. More... | |
(void) | - unbindAllViews |
Unbinds all bound views. More... | |
(GCKMediaRepeatMode) | - cycleRepeatMode |
Changes the repeat mode for the queue to the next mode in the cycle: More... | |
(void) | - selectTracks |
A convenience method for displaying the media track selection UI. More... | |
(void) | - skipAd |
Sends and monitors the skip ad request. More... | |
Property Summary | |
id< GCKUIMediaControllerDelegate > | delegate |
The delegate for receiving notificatiosn from the GCKUIMediaController. More... | |
GCKSession * | session |
The session that is associated with this controller. More... | |
BOOL | mediaLoaded |
Whether there is media currently loaded (or loading) on the receiver. More... | |
BOOL | hasCurrentQueueItem |
Whether there is a current item in the queue. More... | |
BOOL | hasLoadingQueueItem |
Whether there is an item being preloaded in the queue. More... | |
GCKMediaPlayerState | lastKnownPlayerState |
The latest known media player state. More... | |
NSTimeInterval | lastKnownStreamPosition |
The latest known media stream position. More... | |
UIButton * | playButton |
A "play" button. More... | |
UIButton * | pauseButton |
A "pause" button. More... | |
GCKUIMultistateButton * | playPauseToggleButton |
A "play/pause" toggle button. More... | |
GCKUIPlayPauseToggleController * | playPauseToggleController |
A "play/pause" toggle controller. More... | |
UIButton * | stopButton |
A "stop" button. More... | |
UIButton * | forward30SecondsButton |
A button for seeking 30 seconds forward in the currently playing media item. More... | |
UIButton * | rewind30SecondsButton |
A button for seeking 30 seconds back in the currently playing media item. More... | |
UIButton * | pauseQueueButton |
A button for pausing queue playback once the current item finishes playing. More... | |
UIButton * | nextButton |
A "next" button. More... | |
UIButton * | previousButton |
A "previous" button. More... | |
GCKUIMultistateButton * | repeatModeButton |
A button for cycling through the available queue repeat modes. More... | |
UISlider * | streamPositionSlider |
A slider for displaying and changing the current stream position. More... | |
UIProgressView * | streamProgressView |
A view for displaying the current stream progress. More... | |
UILabel * | streamPositionLabel |
A label for displaying the current stream position, in minutes and seconds. More... | |
UILabel * | streamDurationLabel |
A label for displaying the current stream duration, in minutes and seconds. More... | |
UILabel * | streamTimeRemainingLabel |
A label for displaying the remaining stream time (the duration minus the position), in minutes and seconds. More... | |
GCKUIStreamPositionController * | streamPositionController |
A stream posdition controller. More... | |
GCKUIPlaybackRateController * | playbackRateController |
A stream playback rate controller. More... | |
BOOL | displayTimeRemainingAsNegativeValue |
Whether remaining stream time will be displayed as a negative value, for example, "-1:23:45". More... | |
BOOL | hideStreamPositionControlsForLiveContent |
Whether stream position controls (including the stream position slider, the stream position label, the stream duration label, and the stream progress view) should be hidden for live content. More... | |
UIButton * | tracksButton |
A button for selecting audio tracks and/or closed captions or subtitles. More... | |
UILabel * | smartSubtitleLabel |
A label for displaying a subtitle for the currently loaded media. More... | |
UIActivityIndicatorView * | mediaLoadingIndicator |
An activity indicator view for indicating that the media is in a loading state. More... | |
UILabel * | skipAdLabel |
A label for displaying the amount of time left until the ad can be skipped. More... | |
UIButton * | skipAdButton |
A button for skipping the current ad. More... | |
Method Detail
- (instancetype) init |
Initializes an instance.
- (void) bindLabel: | (UILabel *) | label | |
toMetadataKey: | (NSString *) | key | |
Binds a UILabel to a metadata key.
The view will display the current value of the corresponding metadata field.
See GCKMediaMetadata for a list of predefined metadata keys.
- Parameters
-
label The UILabel that will display the value. key The metadata key.
- (void) bindLabel: | (UILabel *) | label | |
toMetadataKey: | (NSString *) | key | |
withFormatter: | (GCKUIValueFormatter) | formatter | |
Binds a UILabel to a metadata key.
The view will display the current value of the corresponding metadata field.
See GCKMediaMetadata for a list of predefined metadata keys.
- Parameters
-
label The UILabel that will display the value. key The metadata key. formatter A block that will produce the desired string representation of the value.
- (void) bindTextView: | (UITextView *) | textView | |
toMetadataKey: | (NSString *) | key | |
Binds a UITextView to a metadata key.
The view will display the current value of the corresponding metadata field.
See GCKMediaMetadata for a list of predefined metadata keys.
- Parameters
-
textView The UITextView that will display the value. key The metadata key.
- (void) bindTextView: | (UITextView *) | textView | |
toMetadataKey: | (NSString *) | key | |
withFormatter: | (GCKUIValueFormatter) | formatter | |
Binds a UITextView to a metadata key.
The view will display the current value of the corresponding metadata field.
See GCKMediaMetadata for a list of predefined metadata keys.
- Parameters
-
textView The UITextView that will display the value. key The metadata key. formatter A block that will produce the desired string representation of the value.
- (void) bindImageView: | (UIImageView *) | imageView | |
toImageHints: | (GCKUIImageHints *) | imageHints | |
Binds a UIImageView to a GCKUIImageHints instance.
The currently installed GCKUIImagePicker will be used to select an image from the metadata for the view.
- Parameters
-
imageView The UIImageView that will display the selected image. imageHints The image hints.
- (void) bindControlView: | (UIControl *) | control | |
toRewindForTime: | (NSTimeInterval) | rewindSeconds | |
Binds a UIControl
to rewind playback of the current item by the passed value as seconds.
The view will be updated based on GCKCastSession
state, the remote playback state and whether it is a livestream. A target is also added to the UIControl
to capture UIControlEventTouchUpInside
event. Do not add target of this type on the UIControl
. To capture the event use the GCKUIMediaControllerDelegate
methods instead.
- Parameters
-
control The UI element that the user interacts with. Typically this would be an instance of UIButton
.rewindSeconds The number of seconds to rewind the media.
- (void) bindControlView: | (UIControl *) | control | |
toForwardForTime: | (NSTimeInterval) | forwardSeconds | |
Binds a UIControl
to forward playback of the current item by the passed value as seconds.
The view will be updated based on GCKCastSession
state, the remote playback state and whether it is a livestream. A target is also added to the UIControl
to capture UIControlEventTouchUpInside
event. Do not add target of this type on the UIControl
. To capture the event use the GCKUIMediaControllerDelegate
methods instead.
- Parameters
-
control The UI element that the user interacts with. Typically this would be an instance of UIButton
.forwardSeconds The number of seconds to skip the media.
- (void) unbindView: | (UIView *) | view |
Unbinds the specified view.
- Parameters
-
view The view to unbind.
- (void) unbindAllViews |
Unbinds all bound views.
- (GCKMediaRepeatMode) cycleRepeatMode |
Changes the repeat mode for the queue to the next mode in the cycle:
GCKMediaRepeatModeOff → GCKMediaRepeatModeAll → GCKMediaRepeatModeSingle → GCKMediaRepeatModeAllAndShuffle
- Returns
- The new repeat mode.
- (void) selectTracks |
A convenience method for displaying the media track selection UI.
- (void) skipAd |
Sends and monitors the skip ad request.
- Since
- 4.3
Property Detail
|
readwritenonatomicweak |
The delegate for receiving notificatiosn from the GCKUIMediaController.
|
readnonatomicstrong |
The session that is associated with this controller.
|
readnonatomicassign |
Whether there is media currently loaded (or loading) on the receiver.
If no Cast session is active, this will be NO
.
|
readnonatomicassign |
Whether there is a current item in the queue.
|
readnonatomicassign |
Whether there is an item being preloaded in the queue.
|
readnonatomicassign |
The latest known media player state.
If no Cast session is active, this will be player state just before the last session ended. If there was no prior session, this will be GCKMediaPlayerStateUnknown.
|
readnonatomicassign |
The latest known media stream position.
If no Cast session is active, this will be the stream position of the media just before the last session ended. If there was no prior session, this will be kGCKInvalidTimeInterval.
|
readwritenonatomicweak |
A "play" button.
When the button is tapped, playback of the currently loaded media is started or resumed on the receiver. The button will be disabled if playback is already in progress, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A "pause" button.
When the button is tapped, playback of the currently loaded media is paused on the receiver. The button will be disabled if the currently loaded media does not support pausing, or if playback is not currently in progress, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A "play/pause" toggle button.
The caller should set appropriate icons for the button's GCKUIButtonStatePlay, GCKUIButtonStatePlayLive, and GCKUIButtonStatePause button states, namely, a "pause" icon for the play state, a "stop" icon for the play-live state, and a "play" icon for the pause state. The button state is automatically updated to reflect the current playback state on the receiver. When the button is tapped, playback of the currently loaded media is paused or resumed on the receiver. The button will be disabled if the currently loaded media does not support pausing, or if playback is not currently in progress or paused, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicstrong |
A "play/pause" toggle controller.
Used as a stand-in for a custom, application-supplied play/pause toggle UI. See GCKUIPlayPauseToggleController for details.
- Since
- 3.4
|
readwritenonatomicweak |
A "stop" button.
When the button is tapped, playback of the currently loaded media is stopped on the receiver. The button will be disabled if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A button for seeking 30 seconds forward in the currently playing media item.
The button will be disabled if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A button for seeking 30 seconds back in the currently playing media item.
The button will be disabled if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A button for pausing queue playback once the current item finishes playing.
|
readwritenonatomicweak |
A "next" button.
When the button is tapped, playback moves to the next media item in the queue. The button will be disabled if the operation is not supported, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A "previous" button.
When the button is tapped, playback moves to the previous media item in the queue. The button will be disabled if the operation is not supported, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A button for cycling through the available queue repeat modes.
(See GCKMediaRepeatMode.) The caller should set appropriate icons for the button's GCKUIButtonStateRepeatOff, GCKUIButtonStateRepeatSingle, GCKUIButtonStateRepeatAll, and GCKUIButtonStateShuffle button states. The button state is automatically updated to reflect the current queue repeat mode on the receiver. Tapping on the button cycles to the next repeat mode, in the order:
GCKMediaRepeatModeOff → GCKMediaRepeatModeAll → GCKMediaRepeatModeSingle → GCKMediaRepeatModeAllAndShuffle
The button will be disabled if there is no Cast session currently active.
|
readwritenonatomicweak |
A slider for displaying and changing the current stream position.
When the slider's value is changed by the user, the stream position of the currently loaded media is updated on the receiver. While playback of media is in progress on the receiver, the slider's value is updated in realtime to reflect the current stream position. The slider will be disabled if the currently loaded media does not support seeking, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A view for displaying the current stream progress.
While playback of media is in progress on the receiver, the views's value is updated in realtime to reflect the current stream position. The view will be disabled if the currently loaded media is a live stream, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A label for displaying the current stream position, in minutes and seconds.
If there is no media currently loaded, or if there is no Cast session currently active, the label displays a localized form of "--:--".
|
readwritenonatomicweak |
A label for displaying the current stream duration, in minutes and seconds.
If the currently loaded media does not have a duration (for example, if it is a live stream), or if there is no media currently loaded, or if there is no Cast session currently active, the label displays a localized form of "--:--".
|
readwritenonatomicweak |
A label for displaying the remaining stream time (the duration minus the position), in minutes and seconds.
If the currently loaded media does not have a duration (for example, if it is a live stream), or if there is no media currently loaded, or if there is no Cast session currently active, the label displays a localized form of "--:--".
|
readwritenonatomicstrong |
A stream posdition controller.
Used as a stand-in for a custom, application-supplied stream position and/or seek UI. See GCKUIStreamPositionController for details.
- Since
- 3.4
|
readwritenonatomicstrong |
|
readwritenonatomicassign |
Whether remaining stream time will be displayed as a negative value, for example, "-1:23:45".
By default this property is set to YES
.
|
readwritenonatomicassign |
Whether stream position controls (including the stream position slider, the stream position label, the stream duration label, and the stream progress view) should be hidden for live content.
The default value is NO
.
- Since
- 4.0
|
readwritenonatomicweak |
A button for selecting audio tracks and/or closed captions or subtitles.
When the button is tapped, the media tracks selection UI is displayed to the user. The button will be disabled if the currently loaded media does not have any selectable media tracks, or if there is no media currently loaded, or if there is no Cast session currently active.
|
readwritenonatomicweak |
A label for displaying a subtitle for the currently loaded media.
If there is no subtitle field explicitly set in the metadata, the label will display the most appropriate metadata field based on the media type, for example the studio name for a movie or the artist name for a music track.
|
readwritenonatomicweak |
An activity indicator view for indicating that the media is in a loading state.
|
readwritenonatomicweak |
A label for displaying the amount of time left until the ad can be skipped.
- Since
- 4.3
|
readwritenonatomicweak |
A button for skipping the current ad.
- Since
- 4.3