LegacyPlayerControlView
@UnstableApi
public class LegacyPlayerControlView extends FrameLayout
| java.lang.Object | ||||
| ↳ | android.view.View | |||
| ↳ | android.view.ViewGroup | |||
| ↳ | android.widget.FrameLayout | |||
| ↳ | androidx.media3.ui.LegacyPlayerControlView |
A view for controlling Player instances.
A LegacyPlayerControlView can be customized by setting attributes (or calling corresponding methods), overriding drawables, overriding the view's layout file, or by specifying a custom view layout file.
Attributes
The following attributes can be set on a LegacyPlayerControlView when used in a layout XML file:show_timeout- The time between the last user interaction and the controls being automatically hidden, in milliseconds. Use zero if the controls should not automatically timeout.- Corresponding method:
setShowTimeoutMs - Default:
DEFAULT_SHOW_TIMEOUT_MS
- Corresponding method:
show_rewind_button- Whether the rewind button is shown.- Corresponding method:
setShowRewindButton - Default: true
- Corresponding method:
show_fastforward_button- Whether the fast forward button is shown.- Corresponding method:
setShowFastForwardButton - Default: true
- Corresponding method:
show_previous_button- Whether the previous button is shown.- Corresponding method:
setShowPreviousButton - Default: true
- Corresponding method:
show_next_button- Whether the next button is shown.- Corresponding method:
setShowNextButton - Default: true
- Corresponding method:
repeat_toggle_modes- A flagged enumeration value specifying which repeat mode toggle options are enabled. Valid values are:none,one,all, orone|all.- Corresponding method:
setRepeatToggleModes - Default:
DEFAULT_REPEAT_TOGGLE_MODES
- Corresponding method:
show_shuffle_button- Whether the shuffle button is shown.- Corresponding method:
setShowShuffleButton - Default: false
- Corresponding method:
time_bar_min_update_interval- Specifies the minimum interval between time bar position updates.- Corresponding method:
setTimeBarMinUpdateInterval - Default:
DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS
- Corresponding method:
controller_layout_id- Specifies the id of the layout to be inflated. See below for more details.- Corresponding method: None
- Default:
R.layout.exo_legacy_player_control_view
- All attributes that can be set on
DefaultTimeBarcan also be set on a LegacyPlayerControlView, and will be propagated to the inflatedDefaultTimeBarunless the layout is overridden to specify a customexo_progress(see below).
Overriding drawables
The drawables used by LegacyPlayerControlView (with its default layout file) can be overridden by drawables with the same names defined in your application. The drawables that can be overridden are:exo_legacy_controls_play- The play icon.exo_legacy_controls_pause- The pause icon.exo_legacy_controls_rewind- The rewind icon.exo_legacy_controls_fastforward- The fast forward icon.exo_legacy_controls_previous- The previous icon.exo_legacy_controls_next- The next icon.exo_legacy_controls_repeat_off- The repeat icon forREPEAT_MODE_OFF.exo_legacy_controls_repeat_one- The repeat icon forREPEAT_MODE_ONE.exo_legacy_controls_repeat_all- The repeat icon forREPEAT_MODE_ALL.exo_legacy_controls_shuffle_off- The shuffle icon when shuffling is disabled.exo_legacy_controls_shuffle_on- The shuffle icon when shuffling is enabled.exo_legacy_controls_vr- The VR icon.
Overriding the layout file
To customize the layout of LegacyPlayerControlView throughout your app, or just for certain configurations, you can defineexo_legacy_player_control_view.xml layout files in your application res/layout* directories. These layouts will override the one provided by the library, and will be inflated for use by LegacyPlayerControlView. The view identifies and binds its children by looking for the following ids:
exo_play- The play button.- Type:
View
- Type:
exo_pause- The pause button.- Type:
View
- Type:
exo_rew- The rewind button.- Type:
View
- Type:
exo_ffwd- The fast forward button.- Type:
View
- Type:
exo_prev- The previous button.- Type:
View
- Type:
exo_next- The next button.- Type:
View
- Type:
exo_repeat_toggle- The repeat toggle button.- Type:
ImageView - Note: LegacyPlayerControlView will programmatically set the drawable on the repeat toggle button according to the player's current repeat mode. The drawables used are
exo_legacy_controls_repeat_off,exo_legacy_controls_repeat_oneandexo_legacy_controls_repeat_all. See the section above for information on overriding these drawables.
- Type:
exo_shuffle- The shuffle button.- Type:
ImageView - Note: LegacyPlayerControlView will programmatically set the drawable on the shuffle button according to the player's current repeat mode. The drawables used are
exo_legacy_controls_shuffle_offandexo_legacy_controls_shuffle_on. See the section above for information on overriding these drawables.
- Type:
exo_vr- The VR mode button.- Type:
View
- Type:
exo_position- Text view displaying the current playback position.- Type:
TextView
- Type:
exo_duration- Text view displaying the current media duration.- Type:
TextView
- Type:
exo_progress_placeholder- A placeholder that's replaced with the inflatedDefaultTimeBar. Ignored if anexo_progressview exists.- Type:
View
- Type:
exo_progress- Time bar that's updated during playback and allows seeking.DefaultTimeBarattributes set on the LegacyPlayerControlView will not be automatically propagated through to this instance. If a view exists with this id, anyexo_progress_placeholderview will be ignored.- Type:
TimeBar
- Type:
All child views are optional and so can be omitted if not required, however where defined they must be of the expected type.
Specifying a custom layout file
Defining your ownexo_legacy_player_control_view.xml is useful to customize the layout of LegacyPlayerControlView throughout your application. It's also possible to customize the layout for a single instance in a layout file. This is achieved by setting the
controller_layout_id attribute on a LegacyPlayerControlView. This will cause the specified layout to be inflated instead of exo_legacy_player_control_view.xml for only the instance on which the attribute is set.
Summary
Nested types |
|---|
public interface LegacyPlayerControlView.ProgressUpdateListenerListener to be notified when progress has been updated. |
public interface LegacyPlayerControlView.VisibilityListenerListener to be notified about changes of the visibility of the UI control. |
Constants |
|
|---|---|
static final int |
The default repeat toggle modes. |
static final int |
DEFAULT_SHOW_TIMEOUT_MS = 5000The default show timeout, in milliseconds. |
static final int |
The default minimum interval between time bar position updates. |
static final int |
The maximum number of windows that can be shown in a multi-window time bar. |
Public constructors |
|---|
LegacyPlayerControlView(Context context) |
LegacyPlayerControlView(Context context, @Nullable AttributeSet attrs) |
LegacyPlayerControlView( |
LegacyPlayerControlView( |
Public methods |
|
|---|---|
void |
Adds a |
boolean |
dispatchKeyEvent(KeyEvent event) |
boolean |
dispatchMediaKeyEvent(KeyEvent event)Called to process media key events. |
final boolean |
|
@Nullable Player |
Returns the |
int |
Returns which repeat toggle modes are enabled. |
boolean |
Returns whether the shuffle button is shown. |
int |
Returns the playback controls timeout. |
boolean |
Returns whether the VR button is shown. |
void |
hide()Hides the controller. |
boolean |
Returns whether the controller is currently visible. |
void |
|
void |
|
void |
Removes a |
void |
setExtraAdGroupMarkers(Sets the millisecond positions of extra ad markers relative to the start of the window (or timeline, if in multi-window mode) and whether each extra ad has been played or not. |
void |
Sets the |
void |
Sets the |
void |
setRepeatToggleModes(Sets which repeat toggle modes are enabled. |
void |
setShowFastForwardButton(boolean showFastForwardButton)Sets whether the fast forward button is shown. |
void |
This method is deprecated. Replace multi-window time bar display by merging source windows together instead, for example using ExoPlayer's |
void |
setShowNextButton(boolean showNextButton)Sets whether the next button is shown. |
void |
setShowPlayButtonIfPlaybackIsSuppressed(Sets whether a play button is shown if playback is |
void |
setShowPreviousButton(boolean showPreviousButton)Sets whether the previous button is shown. |
void |
setShowRewindButton(boolean showRewindButton)Sets whether the rewind button is shown. |
void |
setShowShuffleButton(boolean showShuffleButton)Sets whether the shuffle button is shown. |
void |
setShowTimeoutMs(int showTimeoutMs)Sets the playback controls timeout. |
void |
setShowVrButton(boolean showVrButton)Sets whether the VR button is shown. |
void |
setTimeBarMinUpdateInterval(int minUpdateIntervalMs)Sets the minimum interval between time bar position updates. |
void |
setVrButtonListener(@Nullable View.OnClickListener onClickListener)Sets listener for the VR button. |
void |
show()Shows the playback controls. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Inherited methods |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Constants
DEFAULT_REPEAT_TOGGLE_MODES
@RepeatModeUtil.RepeatToggleModes
public static final int DEFAULT_REPEAT_TOGGLE_MODES = 0
The default repeat toggle modes.
DEFAULT_SHOW_TIMEOUT_MS
public static final int DEFAULT_SHOW_TIMEOUT_MS = 5000
The default show timeout, in milliseconds.
DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS
public static final int DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS = 200
The default minimum interval between time bar position updates.
MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR
public static final int MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR = 100
The maximum number of windows that can be shown in a multi-window time bar.
Public fields
Public constructors
LegacyPlayerControlView
public LegacyPlayerControlView(Context context, @Nullable AttributeSet attrs)
LegacyPlayerControlView
public LegacyPlayerControlView(
Context context,
@Nullable AttributeSet attrs,
int defStyleAttr
)
LegacyPlayerControlView
public LegacyPlayerControlView(
Context context,
@Nullable AttributeSet attrs,
int defStyleAttr,
@Nullable AttributeSet playbackAttrs
)
Public methods
addVisibilityListener
public void addVisibilityListener(
LegacyPlayerControlView.VisibilityListener listener
)
Adds a VisibilityListener.
| Parameters | |
|---|---|
LegacyPlayerControlView.VisibilityListener listener |
The listener to be notified about visibility changes. |
dispatchMediaKeyEvent
public boolean dispatchMediaKeyEvent(KeyEvent event)
Called to process media key events. Any KeyEvent can be passed but only media key events will be handled.
| Parameters | |
|---|---|
KeyEvent event |
A key event. |
| Returns | |
|---|---|
boolean |
Whether the key event was handled. |
getPlayer
public @Nullable Player getPlayer()
Returns the Player currently being controlled by this view, or null if no player is set.
getRepeatToggleModes
@RepeatModeUtil.RepeatToggleModes
public int getRepeatToggleModes()
Returns which repeat toggle modes are enabled.
| Returns | |
|---|---|
int |
The currently enabled |
getShowShuffleButton
public boolean getShowShuffleButton()
Returns whether the shuffle button is shown.
getShowTimeoutMs
public int getShowTimeoutMs()
Returns the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input.
| Returns | |
|---|---|
int |
The duration in milliseconds. A non-positive value indicates that the controls will remain visible indefinitely. |
removeVisibilityListener
public void removeVisibilityListener(
LegacyPlayerControlView.VisibilityListener listener
)
Removes a VisibilityListener.
| Parameters | |
|---|---|
LegacyPlayerControlView.VisibilityListener listener |
The listener to be removed. |
setExtraAdGroupMarkers
public void setExtraAdGroupMarkers(
@Nullable long[] extraAdGroupTimesMs,
@Nullable boolean[] extraPlayedAdGroups
)
Sets the millisecond positions of extra ad markers relative to the start of the window (or timeline, if in multi-window mode) and whether each extra ad has been played or not. The markers are shown in addition to any ad markers for ads in the player's timeline.
| Parameters | |
|---|---|
@Nullable long[] extraAdGroupTimesMs |
The millisecond timestamps of the extra ad markers to show, or |
@Nullable boolean[] extraPlayedAdGroups |
Whether each ad has been played. Must be the same length as |
setProgressUpdateListener
public void setProgressUpdateListener(
@Nullable LegacyPlayerControlView.ProgressUpdateListener listener
)
Sets the ProgressUpdateListener.
| Parameters | |
|---|---|
@Nullable LegacyPlayerControlView.ProgressUpdateListener listener |
The listener to be notified about when progress is updated. |
setRepeatToggleModes
public void setRepeatToggleModes(
@RepeatModeUtil.RepeatToggleModes int repeatToggleModes
)
Sets which repeat toggle modes are enabled.
| Parameters | |
|---|---|
@RepeatModeUtil.RepeatToggleModes int repeatToggleModes |
A set of |
setShowFastForwardButton
public void setShowFastForwardButton(boolean showFastForwardButton)
Sets whether the fast forward button is shown.
| Parameters | |
|---|---|
boolean showFastForwardButton |
Whether the fast forward button is shown. |
setShowNextButton
public void setShowNextButton(boolean showNextButton)
Sets whether the next button is shown.
| Parameters | |
|---|---|
boolean showNextButton |
Whether the next button is shown. |
setShowPlayButtonIfPlaybackIsSuppressed
public void setShowPlayButtonIfPlaybackIsSuppressed(
boolean showPlayButtonIfSuppressed
)
Sets whether a play button is shown if playback is suppressed.
The default is true.
| Parameters | |
|---|---|
boolean showPlayButtonIfSuppressed |
Whether to show a play button if playback is |
setShowPreviousButton
public void setShowPreviousButton(boolean showPreviousButton)
Sets whether the previous button is shown.
| Parameters | |
|---|---|
boolean showPreviousButton |
Whether the previous button is shown. |
setShowRewindButton
public void setShowRewindButton(boolean showRewindButton)
Sets whether the rewind button is shown.
| Parameters | |
|---|---|
boolean showRewindButton |
Whether the rewind button is shown. |
setShowShuffleButton
public void setShowShuffleButton(boolean showShuffleButton)
Sets whether the shuffle button is shown.
| Parameters | |
|---|---|
boolean showShuffleButton |
Whether the shuffle button is shown. |
setShowTimeoutMs
public void setShowTimeoutMs(int showTimeoutMs)
Sets the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input.
| Parameters | |
|---|---|
int showTimeoutMs |
The duration in milliseconds. A non-positive value will cause the controls to remain visible indefinitely. |
setShowVrButton
public void setShowVrButton(boolean showVrButton)
Sets whether the VR button is shown.
| Parameters | |
|---|---|
boolean showVrButton |
Whether the VR button is shown. |
setTimeBarMinUpdateInterval
public void setTimeBarMinUpdateInterval(int minUpdateIntervalMs)
Sets the minimum interval between time bar position updates.
Note that smaller intervals, e.g. 33ms, will result in a smooth movement but will use more CPU resources while the time bar is visible, whereas larger intervals, e.g. 200ms, will result in a step-wise update with less CPU usage.
| Parameters | |
|---|---|
int minUpdateIntervalMs |
The minimum interval between time bar position updates, in milliseconds. |
setVrButtonListener
public void setVrButtonListener(@Nullable View.OnClickListener onClickListener)
Sets listener for the VR button.
| Parameters | |
|---|---|
@Nullable View.OnClickListener onClickListener |
Listener for the VR button, or null to clear the listener. |
show
public void show()
Shows the playback controls. If getShowTimeoutMs is positive then the controls will be automatically hidden after this duration of time has elapsed without user input.