| java.lang.Object | ||
| ↳ | android.support.v4.app.Fragment | |
| ↳ | com.google.android.gms.cast.framework.media.widget.MiniControllerFragment | |
A fragment that provides remote control functionality. This fragment provides an image for the
album art, a ProgressBar for playback progression, and three configurable control
buttons. If developers want to use this fragment, they should add it to their layout XML file,
and the CastContext will automatically manage its state, and handle any user
interactions.
<fragment
android:id="@+id/cast_mini_controller"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"
class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment">
The fragment can show up to three control buttons, from left to right. By default the fragment
shows a play/pause toggle button. Developers can use the attribute castControlButtons to
override what buttons to show. The list of supported control buttons are defined as ID resources:
@id/cast_button_type_empty: Not placing a button in this slot.
@id/cast_button_type_custom: A custom button.
@id/cast_button_type_play_pause_toggle: A button that toggles playback.
@id/cast_button_type_skip_previous: A button that skips to the previous item in the
queue.
@id/cast_button_type_skip_next: A button that skips to the next item in the queue.
@id/cast_button_type_rewind_30_seconds: A button that rewinds the playback by 30
seconds.
@id/cast_button_type_forward_30_seconds: A button that skips forward the playback by 30
seconds.
@id/cast_button_type_mute_toggle: A button that mutes and unmutes the remote receiver.
@id/cast_button_type_closed_caption: A button that opens a dialog to select text and
audio tracks.
Here is an example of showing a rewind button, a play/pause toggle button and a forward button, from left to right:
<array name="cast_mini_controller_control_buttons">
<item>@id/cast_button_type_rewind_30_seconds</item>
<item>@id/cast_button_type_play_pause_toggle</item>
<item>@id/cast_button_type_forward_30_seconds</item>
</array>
...
<fragment
android:id="@+id/cast_mini_controller"
...
app:castControlButtons="@array/cast_mini_controller_control_buttons"
class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment">
The array must contain exactly three items, otherwise a runtime exception will be thrown.
If you don't want to show a button in a slot, use @id/cast_button_type_empty.
The album art can be hidden by setting attribute castShowImageThumbnail to false:
... app:castShowImageThumbnail="false" ...If the album art is shown, then the first control button will not be displayed.
The fragment will be visible when a media session starts, and will be invisible when a media session ends.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the
ImageView of the button at slotIndex in this container. | |||||||||||
Returns the number of slots to hold control buttons in this container.
| |||||||||||
Returns the type of the button at
slotIndex in this container. | |||||||||||
Returns the
UIMediaController used to bind views in this container. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.v4.app.Fragment
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.content.ComponentCallbacks
| |||||||||||
From interface
android.view.View.OnCreateContextMenuListener
| |||||||||||
From interface
com.google.android.gms.cast.framework.media.widget.ControlButtonsContainer
| |||||||||||
Returns the number of slots to hold control buttons in this container.
Returns the type of the button at slotIndex in this container.
Button types are defined as one of the ID resources:
@id/cast_button_type_empty: Not placing a button in this slot.@id/cast_button_type_custom: A custom button.@id/cast_button_type_play_pause_toggle: A button that toggles playback.@id/cast_button_type_skip_previous: A button that skips to the previous item
in the queue.@id/cast_button_type_skip_next: A button that skips to the next item in the
queue.@id/cast_button_type_rewind_30_seconds: A button that rewinds the playback
by 30 seconds.@id/cast_button_type_forward_30_seconds: A button that skips forward the
playback by 30 seconds.@id/cast_button_type_mute_toggle: A button that mutes and unmutes the remote
receiver.@id/cast_button_type_closed_caption: A button that opens a dialog to select
text and audio tracks.| slotIndex | the index of the slot in this container. |
|---|
| IndexOutOfBoundsException |
|---|
Returns the UIMediaController used to bind views in this container.