PlayerControlView
@UnstableApi
public class PlayerControlView extends FrameLayout
| java.lang.Object | ||||
| ↳ | android.view.View | |||
| ↳ | android.view.ViewGroup | |||
| ↳ | android.widget.FrameLayout | |||
| ↳ | androidx.media3.ui.PlayerControlView |
A view for controlling Player instances.
A PlayerControlView can be customized by setting attributes (or calling corresponding methods), or overriding drawables. Note that PlayerControlView is not intended to be used a standalone component outside of PlayerView.
Attributes
The following attributes can be set on aPlayerControlView 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:
show_subtitle_button- Whether the subtitle button is shown.- Corresponding method:
setShowSubtitleButton - Default: false
- Corresponding method:
animation_enabled- Whether an animation is used to show and hide the playback controls.- Corresponding method:
setAnimationEnabled - Default: true
- Corresponding method:
time_bar_scrubbing_enabled- Whether the time bar should seek immediately as the user drags the scrubber around (true), or only seek when the user releases the scrubber (false). This can only be used if theconnected playeris an instance ofandroidx.media3.exoplayer.ExoPlayer.- Corresponding method:
setTimeBarScrubbingEnabled - 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:
- All attributes that can be set on
DefaultTimeBarcan also be set on aPlayerControlView, and will be propagated to the inflatedDefaultTimeBar.
Overriding drawables globally
The drawables used byPlayerControlView can be overridden by drawables with the same names defined in your application. Note that these icons will be the same across all usages of PlayerView/PlayerControlView in your app. The drawables that can be overridden are:
exo_styled_controls_play- The play icon.exo_styled_controls_pause- The pause icon.exo_styled_controls_rewind- The background of rewind icon.exo_styled_controls_fastforward- The background of fast forward icon.exo_styled_controls_previous- The previous icon.exo_styled_controls_next- The next icon.exo_styled_controls_repeat_off- The repeat icon forREPEAT_MODE_OFF.exo_styled_controls_repeat_one- The repeat icon forREPEAT_MODE_ONE.exo_styled_controls_repeat_all- The repeat icon forREPEAT_MODE_ALL.exo_styled_controls_shuffle_off- The shuffle icon when shuffling is disabled.exo_styled_controls_shuffle_on- The shuffle icon when shuffling is enabled.exo_styled_controls_vr- The VR icon.exo_styled_controls_fullscreen_enter- The fullscreen icon for when the player is minimized.exo_styled_controls_fullscreen_exit- The fullscreen icon for when the player is in fullscreen mode.
Overriding drawables locally
If you want to customize drawable per PlayerView instance, you can use the following attributes:PlayerView/PlayerControlView in your app. The drawables that can be overridden are:
play_icon- The drawable resource ID for the play/pause button when play is shown.- Default:
@drawable/exo_styled_controls_play
- Default:
pause_icon- The drawable resource ID for the play/pause button when pause is shown.- Default:
@drawable/exo_styled_controls_pause
- Default:
fastforward_icon- The drawable resource ID for the simple fast forward button without the seek-forward amount. The ID of theimage buttonin such case should beexo_ffwd, specified in theexo_player_control_ffwd_buttonlayout.- Default:
@drawable/exo_styled_controls_simple_fastforward
- Default:
rewind_icon- The drawable resource ID for the simple rewind button without the seek-back amount. The ID of theimage buttonin such case should beexo_rew, specified in theexo_player_control_rewind_buttonlayout.- Default:
@drawable/exo_styled_controls_simple_rewind
- Default:
previous_icon- The drawable resource ID for the previous button.- Default:
@drawable/exo_styled_controls_previous
- Default:
next_icon- The drawable resource ID for the next button.- Default:
@drawable/exo_styled_controls_next
- Default:
repeat_off_icon- The drawable resource ID for the repeat button when the mode isnone.- Default:
@drawable/exo_styled_controls_repeat_off
- Default:
repeat_one_icon- The drawable resource ID for the repeat button when the mode isone.- Default:
@drawable/exo_styled_controls_repeat_one
- Default:
repeat_all_icon- The drawable resource ID for the repeat button when the mode isall.- Default:
@drawable/exo_styled_controls_repeat_all
- Default:
shuffle_on_icon- The drawable resource ID for the repeat button when the mode isone.- Default:
@drawable/exo_styled_controls_shuffle_on
- Default:
shuffle_off_icon- The drawable resource ID for the repeat button when the mode isall.- Default:
@drawable/exo_styled_controls_shuffle_off
- Default:
subtitle_on_icon- The drawable resource ID for the subtitle button when the text track is on.- Default:
@drawable/exo_styled_controls_subtitle_on
- Default:
subtitle_off_icon- The drawable resource ID for the subtitle button when the text track is off.- Default:
@drawable/exo_styled_controls_subtitle_off
- Default:
vr_icon- The drawable resource ID for the VR button.- Default:
@drawable/exo_styled_controls_vr
- Default:
fullscreen_enter_icon- The drawable resource ID for the fullscreen button when the player is minimized.- Default:
@drawable/exo_styled_controls_fullscreen_enter
- Default:
fullscreen_exit_icon- The drawable resource ID for the fullscreen button when the player is in fullscreen mode.- Default:
@drawable/exo_styled_controls_fullscreen_exit
- Default:
Summary
Nested types |
|---|
public interface PlayerControlView.OnFullScreenModeChangedListenerThis interface is deprecated. Register a |
public interface PlayerControlView.ProgressUpdateListenerListener to be notified when progress has been updated. |
public interface PlayerControlView.VisibilityListenerThis interface is deprecated. Register a |
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 |
|---|
PlayerControlView(Context context) |
PlayerControlView(Context context, @Nullable AttributeSet attrs) |
PlayerControlView( |
PlayerControlView( |
Public methods |
|
|---|---|
void |
This method is deprecated. Register a |
boolean |
dispatchKeyEvent(KeyEvent event) |
boolean |
dispatchMediaKeyEvent(KeyEvent event)Called to process media key events. |
@Nullable Player |
Returns the |
int |
Returns which repeat toggle modes are enabled. |
boolean |
Returns whether the shuffle button is shown. |
boolean |
Returns whether the subtitle button is shown. |
int |
Returns the playback controls timeout. |
boolean |
Returns whether the VR button is shown. |
void |
hide()Hides the controller. |
void |
Hides the controller without any animation. |
boolean |
Returns whether an animation is used to show and hide the playback controls. |
boolean |
Returns whether the controller is fully visible, which means all UI controls are visible. |
boolean |
Returns whether the controller is currently visible. |
void |
|
void |
|
void |
This method is deprecated. Register a |
void |
setAnimationEnabled(boolean animationEnabled)Sets whether an animation is used to show and hide the playback controls. |
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 |
setMediaRouteButtonViewProvider(Sets a |
void |
This method is deprecated. Register a |
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 |
setShowSubtitleButton(boolean showSubtitleButton)Sets whether the subtitle 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 |
setTimeBarScrubbingEnabled(boolean timeBarScrubbingEnabled)Sets whether the time bar should seek immediately as the user drags the scrubber around (true), or only seek when the user releases the scrubber (false). |
void |
setVrButtonListener(@Nullable View.OnClickListener onClickListener)Sets listener for the VR button. |
void |
show()Shows the playback controls. |
void |
updateIsFullscreen(boolean isFullscreen)Updates whether the controller is in fullscreen, changing its fullscreen icon and reports it to to the listener. |
Protected methods |
|
|---|---|
void |
onLayout(boolean changed, int left, int top, int right, int bottom) |
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
PlayerControlView
public PlayerControlView(
Context context,
@Nullable AttributeSet attrs,
int defStyleAttr
)
PlayerControlView
public PlayerControlView(
Context context,
@Nullable AttributeSet attrs,
int defStyleAttr,
@Nullable AttributeSet playbackAttrs
)
Public methods
addVisibilityListener
public voidaddVisibilityListener(PlayerControlView.VisibilityListener listener)
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.
getShowSubtitleButton
public boolean getShowSubtitleButton()
Returns whether the subtitle 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. |
isAnimationEnabled
public boolean isAnimationEnabled()
Returns whether an animation is used to show and hide the playback controls.
isFullyVisible
public boolean isFullyVisible()
Returns whether the controller is fully visible, which means all UI controls are visible.
removeVisibilityListener
public voidremoveVisibilityListener(
PlayerControlView.VisibilityListener listener
)
setAnimationEnabled
public void setAnimationEnabled(boolean animationEnabled)
Sets whether an animation is used to show and hide the playback controls.
| Parameters | |
|---|---|
boolean animationEnabled |
Whether an animation is applied to show and hide playback controls. |
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 |
setMediaRouteButtonViewProvider
public void setMediaRouteButtonViewProvider(
@Nullable ViewProvider mediaRouteButtonViewProvider
)
Sets a ViewProvider to be used for creating the media route button view.
If a provider is set, this PlayerControlView will obtain the media route button view from the provider and display it.
If ViewProvider is null, any previously set media route button will be removed.
| Parameters | |
|---|---|
@Nullable ViewProvider mediaRouteButtonViewProvider |
The |
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the media route button fails to display due to an unexpected error. |
setOnFullScreenModeChangedListener
public voidsetOnFullScreenModeChangedListener(
@Nullable PlayerControlView.OnFullScreenModeChangedListener listener
)
setProgressUpdateListener
public void setProgressUpdateListener(
@Nullable PlayerControlView.ProgressUpdateListener listener
)
Sets the ProgressUpdateListener.
| Parameters | |
|---|---|
@Nullable PlayerControlView.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. |
setShowSubtitleButton
public void setShowSubtitleButton(boolean showSubtitleButton)
Sets whether the subtitle button is shown.
| Parameters | |
|---|---|
boolean showSubtitleButton |
Whether the subtitle 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. |
setTimeBarScrubbingEnabled
public void setTimeBarScrubbingEnabled(boolean timeBarScrubbingEnabled)
Sets whether the time bar should seek immediately as the user drags the scrubber around (true), or only seek when the user releases the scrubber (false).
This can only be used if the connected player is an instance of androidx.media3.exoplayer.ExoPlayer.
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.
updateIsFullscreen
public void updateIsFullscreen(boolean isFullscreen)
Updates whether the controller is in fullscreen, changing its fullscreen icon and reports it to to the listener.
For isFullscreen equals true the icon will be set to @drawable/exo_styled_controls_fullscreen_exit or else @drawable/exo_styled_controls_fullscreen_enter.
| Parameters | |
|---|---|
boolean isFullscreen |
If the view is in full screen. |