java.lang.Object | |
↳ | com.google.android.gms.cast.framework.media.uicontroller.UIMediaController |
A UIMediaController
lets you bind the state of Android UI components to the state of a
remote CastSession
. This class simplifies writing a sender UI with playback controls. To
use this class, create an instance of this class, then call various bind methods to associate
state of your Android UI components to a remote playback control, or the change of the remote
playback state or metadata.
When a View
is bound to the UIMediaController
, on the one hand, UIMediaController
will update its UI state according to the CastSession
state, the
remote playback state or metadata. On the other hand, if the View
is bound to a remote
playback command (such as "SkipNext" button), UIMediaController
will also register
relevant listeners to the View
so that when the user interacts with the control, the
controller will perform the corresponding action.
Take bindViewToSkipNext(View, int)
as an example. When a View
is bound to the UIMediaController
, UIMediaController
will update the state of the View
based on
the status of the CastSession
, such that it will only be enabled when the CastSession
is connected and there is a next item in the queue. A View.OnClickListener
will also be set on the View
such that when the View
is clicked, the event will
be forwarded to onSkipNextClicked(View)
, whose default behavior is to call queueNext(JSONObject)
on the RemoteMediaClient
:
protected void onSkipNextClicked(View view) { RemoteMediaClient remoteMediaClient = getRemoteMediaClient(); if ((remoteMediaClient != null) && remoteMediaClient.hasMediaSession()) { remoteMediaClient.queueNext(null /* customData */); } }If the app needs to perform custom behavior in addition to, or instead of, the default behavior for a given action, it can subclass UIMediaController and override the corresponding event-handling method. For example:
public class CustomUIMediaController extends UIMediaController { // Ommiting other methods. @Override protected void onSkipNextClicked(View view) { doSomeCustomAction(); super.onSkipNextClicked(view); // Optional } }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs an instance of
UIMediaController that will be used to bind UI elements of an
activity . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
Use
bindImageViewToImageOfCurrentItem(ImageView, ImageHints, int) instead.
| |||||||||||
This method is deprecated.
Use
bindImageViewToImageOfCurrentItem(ImageView, ImageHints, View)
instead.
| |||||||||||
Binds an
ImageView to the first image of the current item. | |||||||||||
Binds an
ImageView to an image of the current item. | |||||||||||
This method is deprecated.
Use
bindImageViewToImageOfPreloadedItem(ImageView, ImageHints, int)
instead.
| |||||||||||
Binds an
ImageView to the first image of the preloaded item. | |||||||||||
Binds an
ImageView to mute and unmute the Cast receiver device volume. | |||||||||||
Binds an
ImageView to toggle play / pause of the current item. | |||||||||||
Binds a
ProgressBar to the playback progress of the current item. | |||||||||||
Binds a
ProgressBar to the playback progress of the current item. | |||||||||||
Binds a
SeekBar to control the playback position of the current item. | |||||||||||
Binds a
SeekBar to control the playback position of the current item. | |||||||||||
Binds a
TextView to the metadata of the current item, keyed by key . | |||||||||||
Binds a
TextView to the metadata of the current item, keyed by a list of keys in the
order of preferences. | |||||||||||
Binds an
TextView to the metadata of the preloaded item, keyed by a list of keys in the
order of preferences. | |||||||||||
Binds an
TextView to the metadata of the preloaded item, keyed by key . | |||||||||||
Binds a
TextView to the most appropriate item in MediaMetadata for subtitle. | |||||||||||
Binds a
TextView to the playback duration of the current item. | |||||||||||
Binds a
TextView to the playback duration of the current item. | |||||||||||
Binds a
TextView to the playback position of the current item. | |||||||||||
Binds a
TextView to the playback position of the current item. | |||||||||||
Binds a
View to launching the TracksChooserDialogFragment when clicked. | |||||||||||
Binds a
View to skip forward playback of the current item skipStepMs
milliseconds. | |||||||||||
Binds a
View to launching the expanded controller Activity specified by the
name in getExpandedControllerActivityClassName() . | |||||||||||
Binds a
View to rewind playback of the current item skipStepMs milliseconds. | |||||||||||
Binds a
View to skip to the next item in the queue. | |||||||||||
Binds a
View to skip to the previous item in the queue. | |||||||||||
Binds a
View to a UIController . | |||||||||||
Binds a
View 's visibility state to the availability of a Cast media session. | |||||||||||
Binds a
View 's visibility state to the availability of a preloaded item. | |||||||||||
Disposes this instance.
| |||||||||||
Returns the managed
RemoteMediaClient of the current active CastSession . | |||||||||||
Returns true if there is an active connected Cast Session.
| |||||||||||
Called when updated ad break status information is received.
| |||||||||||
Called when updated media metadata is received.
| |||||||||||
Called when updated player queue preload status information is received, for example, the
next item to play has been preloaded.
| |||||||||||
Called when updated player queue status information is received.
| |||||||||||
Called when there is an out going request to the receiver.
| |||||||||||
Called when updated player status information is received.
| |||||||||||
Sets a
RemoteMediaClient.Listener that will be called after all the other registered
listeners in the UIMediaController instance are invoked. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The callback that is invoked when the user clicks on an
View bound to this UIMediaController through bindViewToClosedCaption(View) . | |||||||||||
The callback that is invoked when the user clicks on an
View bound to this UIMediaController through bindViewToForward(View, long) . | |||||||||||
The callback that is invoked when the user clicks on an
View bound to this UIMediaController through bindViewToLaunchExpandedController(View) . | |||||||||||
The callback that is invoked when the user clicks on an
ImageView bound to this UIMediaController through bindImageViewToMuteToggle(ImageView) . | |||||||||||
The callback that is invoked when the user clicks on an
ImageView bound to this UIMediaController through bindImageViewToPlayPauseToggle(ImageView, Drawable, Drawable, Drawable, View, boolean) . | |||||||||||
The callback that is invoked when the user clicks on an
View bound to this UIMediaController through bindViewToRewind(View, long) . | |||||||||||
The callback that is invoked on progress change of a
SeekBar bound to this UIMediaController through bindSeekBar(SeekBar) . | |||||||||||
The callback that is invoked when the user starts a touch gesture on a
SeekBar bound to
this UIMediaController through bindSeekBar(SeekBar) . | |||||||||||
The callback that is invoked when the user finished a touch gesture on a
SeekBar bound
to this UIMediaController through bindSeekBar(SeekBar) . | |||||||||||
The callback that is invoked when the user clicks on an
View bound to this UIMediaController through bindViewToSkipNext(View, int) . | |||||||||||
The callback that is invoked when the user clicks on an
View bound to this UIMediaController through bindViewToSkipPrev(View, int) . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructs an instance of UIMediaController
that will be used to bind UI elements of an
activity
.
Parameters | |
---|---|
activity |
Activity |
This method is deprecated.
Use bindImageViewToImageOfCurrentItem(ImageView, ImageHints, int)
instead.
Binds an ImageView
to the first image of the current item. If the current item doesn't
contain any image or the framework fails to fetch the Bitmap for the image, imagePlaceHolder
will be used instead.
Parameters | |
---|---|
view |
ImageView : The View to bind. |
imageType |
int : Type of image, used by the ImagePicker to choose the proper image. |
placeHolderDrawableResId |
int : The resource ID of a Drawable used as a placeholder if
no image is available from the current item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
This method is deprecated.
Use bindImageViewToImageOfCurrentItem(ImageView, ImageHints, View)
instead.
Binds an ImageView
to an image of the current item. When an item is loaded, and there
is a WebImage
that is suitable to be displayed, the Bitmap
of that image will
be fetched and set on the ImageView
. If the item contains multiple images, this class
will choose one using the ImagePicker
configured in CastMediaOptions
, with the
given imageType
.
Parameters | |
---|---|
view |
ImageView : The ImageView . |
imageType |
int : Type of image, used by the ImagePicker to choose the proper image. |
placeHolderView |
View : The View to show as a placeholder if no image is available from
the current item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds an ImageView
to the first image of the current item. If the current item doesn't
contain any image or the framework fails to fetch the Bitmap for the image, imagePlaceHolder
will be used instead.
Parameters | |
---|---|
view |
ImageView : The View to bind. |
imageHints |
ImageHints : ImageHints used by the ImagePicker to choose the proper
image. |
placeHolderDrawableResId |
int : The resource ID of a Drawable used as a placeholder if
no image is available from the current item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds an ImageView
to an image of the current item. When an item is loaded, and there
is a WebImage
that is suitable to be displayed, the Bitmap
of that image will
be fetched and set on the ImageView
. If the item contains multiple images, this class
will choose one using the ImagePicker
configured in CastMediaOptions
, with the
given imageType
.
Parameters | |
---|---|
view |
ImageView : The ImageView . |
imageHints |
ImageHints : ImageHints used by the ImagePicker to choose the proper
image. |
placeHolderView |
View : The View to show as a placeholder if no image is available from
the current item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
This method is deprecated.
Use bindImageViewToImageOfPreloadedItem(ImageView, ImageHints, int)
instead.
Binds an ImageView
to the first image of the preloaded item. If the current item
doesn't contain any image or the framework fails to fetch the Bitmap for the image, imagePlaceHolder
will be used instead.
Parameters | |
---|---|
view |
ImageView : The View to bind. |
imageType |
int : Type of image, used by the ImagePicker to choose the proper image. |
placeHolderDrawableResId |
int : The resource ID of a Drawable used as a placeholder if
no image is available from the preloaded item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds an ImageView
to the first image of the preloaded item. If the current item
doesn't contain any image or the framework fails to fetch the Bitmap for the image, imagePlaceHolder
will be used instead.
Parameters | |
---|---|
view |
ImageView : The View to bind. |
imageHints |
ImageHints : ImageHints used by the ImagePicker to choose the proper
image. |
placeHolderDrawableResId |
int : The resource ID of a Drawable used as a placeholder if
no image is available from the preloaded item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds an ImageView
to mute and unmute the Cast receiver device volume.
The ImageView
will be updated based on the CastSession
connection state and
muted state. A View.OnClickListener
will also be set to the ImageView
so that
when it is clicked, the listener will call onMuteToggleClicked(ImageView)
to handle the click
event. Do not call setOnClickListener(View.OnClickListener)
on the ImageView
. To override the
behavior, create a subclass of UIMediaController
and override the onMuteToggleClicked(ImageView)
method.
Parameters | |
---|---|
view |
ImageView : The ImageView to bind. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds an ImageView
to toggle play / pause of the current item.
The ImageView
will be updated based on the CastSession
state and remote
playback state. A View.OnClickListener
will also be set to the ImageView
so
that when it is clicked, the listener will call onPlayPauseToggleClicked(ImageView)
to handle the
click event. Do not call setOnClickListener(View.OnClickListener)
on the ImageView
. To override
the behavior, create a subclass of UIMediaController
and override the onPlayPauseToggleClicked(ImageView)
method.
Parameters | |
---|---|
view |
ImageView : The ImageView to bind. |
playDrawable |
Drawable : The Drawable to use when the state of the control is "play". |
pauseDrawable |
Drawable : The Drawable to use when the state of the control is "pause". |
stopDrawable |
Drawable : The Drawable to use when the state of the control is "stop live
stream". If set to null , the framework will display the pauseDrawable when
a "stop live stream" icon is needed. |
loadingIndicator |
View : A View that should be displayed to indicate that a remote
request is ongoing. |
hideViewWhenLoading |
boolean : true if visibility of imageView should be set to
INVISIBLE when loading an item, false if it should be set to VISIBLE when loading an item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a ProgressBar
to the playback progress of the current item. Progress will be
updated once per second. If no item is loaded the progress of the ProgressBar
will be
set to zero.
Parameters | |
---|---|
view |
ProgressBar : The ProgressBar to bind. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a ProgressBar
to the playback progress of the current item. Progress will be
updated once per progressUpdateStepMs
milliseconds. If no item is loaded the progress
of the ProgressBar
will be set to zero.
Parameters | |
---|---|
view |
ProgressBar : The ProgressBar to bind. |
progressUpdateStepMs |
long : The interval between each update of the progress, in milliseconds. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a SeekBar
to control the playback position of the current item.
The SeekBar
will be updated based on the CastSession
state and remote
playback progress. Progress will be updated once per progressUpdateStepMs
milliseconds.
If no item is loaded, the progress of the SeekBar
will be set to zero and the SeekBar
will be disabled. A SeekBar.OnSeekBarChangeListener
will also be set to the
SeekBar
so that when the user interacts with the SeekBar
, it will forward the
listener events to this UIMediaController
to handle the event. onStopTrackingTouch(SeekBar)
will be forwarded to onSeekBarStopTrackingTouch(SeekBar)
. onStartTrackingTouch(SeekBar)
will
be forwarded to onSeekBarStartTrackingTouch(SeekBar)
. onProgressChanged(SeekBar, int, boolean)
will be forwarded to onSeekBarProgressChanged(SeekBar, int, boolean)
. Do not call setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener)
on the
SeekBar
. To override the behavior, create a subclass of UIMediaController
and
override the onSeekBarProgressChanged(SeekBar, int, boolean)
, onSeekBarStartTrackingTouch(SeekBar)
and onSeekBarStopTrackingTouch(SeekBar)
methods.
Parameters | |
---|---|
view |
SeekBar : The SeekBar to bind. |
progressUpdateStepMs |
long : The interval between each update of the progress, in milliseconds. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a SeekBar
to control the playback position of the current item.
The SeekBar
will be updated based on the CastSession
state and remote
playback progress. Progress will be updated once per second. If no item is loaded, the progress
of the SeekBar
will be set to zero and the SeekBar
will be disabled. A SeekBar.OnSeekBarChangeListener
will also be set to the SeekBar
so that when the user
interacts with the SeekBar
, it will forward the listener events to this UIMediaController
to handle the event. onStopTrackingTouch(SeekBar)
will be forwarded to onSeekBarStopTrackingTouch(SeekBar)
. onStartTrackingTouch(SeekBar)
will
be forwarded to onSeekBarStartTrackingTouch(SeekBar)
. onProgressChanged(SeekBar, int, boolean)
will be forwarded to onSeekBarProgressChanged(SeekBar, int, boolean)
. Do not call setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener)
on the
SeekBar
. To override the behavior, create a subclass of UIMediaController
and
override the onSeekBarProgressChanged(SeekBar, int, boolean)
, onSeekBarStartTrackingTouch(SeekBar)
and onSeekBarStopTrackingTouch(SeekBar)
methods.
Parameters | |
---|---|
view |
SeekBar : The SeekBar to bind. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a TextView
to the metadata of the current item, keyed by key
. If metadata
for key
is unavailable, the TextView will be left untouched.
Parameters | |
---|---|
view |
TextView : The View to bind. |
key |
String : The key of the metadata field to bind. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds an TextView
to the metadata of the preloaded item, keyed by key
. If
metadata for key
is unavailable, the TextView will be left untouched.
Parameters | |
---|---|
view |
TextView : The View to bind. |
key |
String : The key of the metadata field to bind. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a TextView
to the most appropriate item in MediaMetadata
for subtitle. For example the studio name for a
movie or the artist name for a music track.
Parameters | |
---|---|
textView |
TextView |
Binds a TextView
to the playback duration of the current item. If no item is loaded, or
if the currently playing item is a live stream, then the text will be set to "--:--".
When playing a live stream item, if liveStreamIndicator
is not null
, then
view
will be hidden and liveStreamIndicator
will be shown to better indicate
that a live stream is playing.
Parameters | |
---|---|
view |
TextView : The TextView to bind. |
liveStreamIndicator |
View : If View to indicate that a live stream items is playing. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a TextView
to the playback position of the current item. Position will be updated
once per second. If no item is loaded the text will be set to "--:--".
Parameters | |
---|---|
view |
TextView : The TextView to bind. |
updateWhileScrubbing |
boolean : If this is set to true , the View will be put in the
update-when-scrubbing set and will be updated to the position of a bound SeekBar
while is is being scrubbed. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a TextView
to the playback position of the current item. Position will be updated
once per progressUpdateStepMs
milliseconds. If no item is loaded the text will be set
to "--:--".
Parameters | |
---|---|
view |
TextView : The TextView to bind. |
updateWhileScrubbing |
boolean : If this is set to true , the View will be put in the
update-when-scrubbing set and will be updated to the position of a bound SeekBar
while is is being scrubbed. |
progressUpdateStepMs |
long : The interval between each update of the progress, in milliseconds. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to launching the TracksChooserDialogFragment
when clicked.
The view will be updated based on the CastSession
state and the availability of
audio and text tracks. A View.OnClickListener
will also be set to the view so that when
the view is clicked, it will call onClosedCaptionClicked(View)
to handle the click event. Do
not call setOnClickListener(View.OnClickListener)
on the view. To override the behavior, create a
subclass of UIMediaController
and override the onClosedCaptionClicked(View)
method.
Parameters | |
---|---|
view |
View |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to skip forward playback of the current item skipStepMs
milliseconds.
The View
will be updated based on the CastSession
state, the remote playback
progress and whether it is livestream. A View.OnClickListener
will also be set to the
View
so that when it is clicked, the listener will call onForwardClicked(View, long)
to
handle the click event. Do not call setOnClickListener(View.OnClickListener)
on the View
. To
override the behavior, create a subclass of UIMediaController
and override the onForwardClicked(View, long)
method.
Parameters | |
---|---|
view |
View : The View to bind. |
skipStepMs |
long : Time (in milliseconds) to skip forward. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to launching the expanded controller Activity
specified by the
name in getExpandedControllerActivityClassName()
.
The View
will be updated based on the CastSession
state. A View.OnClickListener
will also be set to the View
so that when it is clicked, the
listener will call onLaunchExpandedControllerClicked(View)
to handle the click event. Do not
call setOnClickListener(View.OnClickListener)
on the View
. To override the behavior, create a
subclass of UIMediaController
and override the onLaunchExpandedControllerClicked(View)
method.
Parameters | |
---|---|
view |
View |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to rewind playback of the current item skipStepMs
milliseconds.
The View
will be updated based on the CastSession
state, the remote playback
state and whether it is livestream. A View.OnClickListener
will also be set to the
View
so that when it is clicked, the listener will call onRewindClicked(View, long)
to
handle the click event. Do not call setOnClickListener(View.OnClickListener)
on the View
. To
override the behavior, create a subclass of UIMediaController
and override the onRewindClicked(View, long)
method.
Parameters | |
---|---|
view |
View : The View to bind. |
skipStepMs |
long : Time (in milliseconds) to rewind. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to skip to the next item in the queue.
The View
will be updated based on the CastSession
state, the remote playback
state and the availability of the next queue item. A View.OnClickListener
will also be
set to the View
so that when it is clicked, the listener will call onSkipNextClicked(View)
to handle the click event. Do not call setOnClickListener(View.OnClickListener)
on
the View
. To override the behavior, create a subclass of UIMediaController
and
override the onSkipNextClicked(View)
method.
Parameters | |
---|---|
view |
View : The View to bind. |
invisibleState |
int : Either INVISIBLE or GONE . This parameter will
be set as the visibility of View when there isn't a previous item in the queue. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to skip to the previous item in the queue.
The View
will be updated based on the CastSession
state, the remote playabck
state and the availability of the previous queue item. A View.OnClickListener
will also
be set to the View
so that when it is clicked, the listener will call onSkipPrevClicked(View)
to handle the click event. Do not call setOnClickListener(View.OnClickListener)
on
the View
. To override the behavior, create a subclass of UIMediaController
and
override the onSkipPrevClicked(View)
method.
Parameters | |
---|---|
view |
View : The View to bind. |
invisibleState |
int : Either INVISIBLE or GONE . This parameter will
be set as the visibility of View when there isn't a previous item in the queue. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
to a UIController
. This method is typically used when the uiController
is used to implement a custom control button.
Parameters | |
---|---|
view |
View : The View to bind. |
uiController |
UIController : The UIController of the view . |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
's visibility state to the availability of a Cast media session. View
will be set to VISIBLE
when there is a media session, and will be set to
invisibleState
when there isn't a media session.
Parameters | |
---|---|
view |
View : The View to bind. |
invisibleState |
int : Either INVISIBLE or GONE , which will be set as
the visibility of view when there isn't a media session. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Binds a View
's visibility state to the availability of a preloaded item. View
will be set to VISIBLE
when there is a preloaded item, and will be set to invisibleState
when there isn't a preloaded item.
Parameters | |
---|---|
view |
View : The View to bind. |
invisibleState |
int : Either INVISIBLE or GONE , which will be set as
the visibility of view when there isn't a preloaded item. |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Disposes this instance. The UIMediaController
can not be reused after this method is
called.
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Returns the managed RemoteMediaClient
of the current active CastSession
.
Returns | |
---|---|
RemoteMediaClient |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Returns true if there is an active connected Cast Session.
Returns | |
---|---|
boolean |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
Called when updated ad break status information is received.
Called when updated media metadata is received.
Called when updated player queue preload status information is received, for example, the next item to play has been preloaded. This gives the caller a chance to response to preloading related event, such as displaying what will be played next in the UI.
Called when updated player queue status information is received.
Called when there is an out going request to the receiver. This gives the caller a chance to update state of the UI of the sender app, for example, disable some controls.
Parameters | |
---|---|
session |
CastSession |
error |
int |
Parameters | |
---|---|
session |
CastSession |
error |
int |
Parameters | |
---|---|
session |
CastSession |
wasSuspended |
boolean |
Parameters | |
---|---|
session |
CastSession |
sessionId |
String |
Parameters | |
---|---|
session |
CastSession |
error |
int |
Parameters | |
---|---|
session |
CastSession |
sessionId |
String |
Parameters | |
---|---|
session |
CastSession |
reason |
int |
Called when updated player status information is received.
Sets a RemoteMediaClient.Listener
that will be called after all the other registered
listeners in the UIMediaController
instance are invoked. Also, the states of all the
bound View
instances are guaranteed to be updated before this listener is invoked.
This listener is useful if you want to modify the state of the bound View
instances.
Parameters | |
---|---|
listener |
RemoteMediaClient.Listener |
Throws | |
---|---|
IllegalStateException |
If this method is not called on the main thread. |
The callback that is invoked when the user clicks on an View
bound to this UIMediaController
through bindViewToClosedCaption(View)
.
The default behavior is to launch the TracksChooserDialogFragment
if the Activity
used to construct this UIMediaController
is a FragmentActivity
and
the remote media is loaded.
Parameters | |
---|---|
view |
View : The View that the user clicked.
|
The callback that is invoked when the user clicks on an View
bound to this UIMediaController
through bindViewToForward(View, long)
.
The default behavior is to call the seek(long)
method of getRemoteMediaClient()
if the remote media is loaded, with the position of getRemoteMediaClient().getApproximateStreamPosition() + skipStepMs
.
Parameters | |
---|---|
view |
View : The View that the user clicked. |
skipStepMs |
long : The amount of time, in milliseconds, that the playback position will move
forward by when the View is clicked.
|
The callback that is invoked when the user clicks on an View
bound to this UIMediaController
through bindViewToLaunchExpandedController(View)
.
The default behavior is to launch the expanded controller Activity
specified by the
name in getExpandedControllerActivityClassName()
of CastMediaOptions
.
Parameters | |
---|---|
view |
View : The View that the user clicked.
|
The callback that is invoked when the user clicks on an ImageView
bound to this UIMediaController
through bindImageViewToMuteToggle(ImageView)
.
The default behavior is to toggle the muted state of the CastSession
if there is one
and it is connected.
Parameters | |
---|---|
view |
ImageView : The ImageView that the user clicked.
|
The callback that is invoked when the user clicks on an ImageView
bound to this UIMediaController
through bindImageViewToPlayPauseToggle(ImageView, Drawable, Drawable, Drawable, View, boolean)
.
The default behavior is to call the togglePlayback()
method of
getRemoteMediaClient()
if the remote media is loaded.
Parameters | |
---|---|
view |
ImageView : The ImageView that the user clicked.
|
The callback that is invoked when the user clicks on an View
bound to this UIMediaController
through bindViewToRewind(View, long)
.
The default behavior is to call the seek(long)
method of getRemoteMediaClient()
if the remote media is loaded, with the position of getRemoteMediaClient().getApproximateStreamPosition() - skipStepMs
.
Parameters | |
---|---|
view |
View : The View that the user clicked. |
skipStepMs |
long : The amount of time, in milliseconds, that the playback position will move
backward by when the View is clicked.
|
The callback that is invoked on progress change of a SeekBar
bound to this UIMediaController
through bindSeekBar(SeekBar)
.
The default behavior is: if the progress change comes from a user action, use progress
to update the progress of all views in the update-when-scrubbing set.
Parameters | |
---|---|
seekBar |
SeekBar : The SeekBar that the user is scrubbing. |
progress |
int : The current progress level. |
fromUser |
boolean : True if the progress change was initiated by the user.
|
The callback that is invoked when the user starts a touch gesture on a SeekBar
bound to
this UIMediaController
through bindSeekBar(SeekBar)
.
The default behavior is to detach the seekBar
and all the views in the
update-when-scrubbing set from the CastSession
to stop receiving furthur playback
progress updates.
Parameters | |
---|---|
seekBar |
SeekBar : The SeekBar that the user is scrubbing.
|
The callback that is invoked when the user finished a touch gesture on a SeekBar
bound
to this UIMediaController
through bindSeekBar(SeekBar)
.
The default behavior is to reattach the seekBar
and all the views in the
update-when-scrubbing set to the CastSession
to receive furthur playback progress
updates. Then the method will call seek(long)
method of getRemoteMediaClient()
if the remote media is loaded.
Parameters | |
---|---|
seekBar |
SeekBar : The SeekBar that the user is scrubbing.
|
The callback that is invoked when the user clicks on an View
bound to this UIMediaController
through bindViewToSkipNext(View, int)
.
The default behavior is to call the queueNext(JSONObject)
method of getRemoteMediaClient()
if the remote media is loaded, with customData
of null
.
Parameters | |
---|---|
view |
View : The View that the user clicked.
|
The callback that is invoked when the user clicks on an View
bound to this UIMediaController
through bindViewToSkipPrev(View, int)
.
The default behavior is to call the queuePrev(JSONObject)
method of getRemoteMediaClient()
if the remote media is loaded, with customData
of null
.
Parameters | |
---|---|
view |
View : The View that the user clicked.
|