Class StyledPlayerControlView

  • All Implemented Interfaces:
    Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent

    @Deprecated
    public class StyledPlayerControlView
    extends FrameLayout
    Deprecated.
    com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    A view for controlling Player instances.

    A StyledPlayerControlView can be customized by setting attributes (or calling corresponding methods), or overriding drawables.

    Attributes

    The following attributes can be set on a StyledPlayerControlView when used in a layout XML file:

    Overriding drawables

    The drawables used by StyledPlayerControlView can be overridden by drawables with the same names defined in your application. 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 for Player.REPEAT_MODE_OFF.
    • exo_styled_controls_repeat_one - The repeat icon for Player.REPEAT_MODE_ONE.
    • exo_styled_controls_repeat_all - The repeat icon for Player.REPEAT_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.
    • Field Detail

      • DEFAULT_SHOW_TIMEOUT_MS

        public static final int DEFAULT_SHOW_TIMEOUT_MS
        Deprecated.
        The default show timeout, in milliseconds.
        See Also:
        Constant Field Values
      • DEFAULT_REPEAT_TOGGLE_MODES

        @RepeatToggleModes
        public static final @com.google.android.exoplayer2.util.RepeatModeUtil.RepeatToggleModes int DEFAULT_REPEAT_TOGGLE_MODES
        Deprecated.
        The default repeat toggle modes.
        See Also:
        Constant Field Values
      • DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS

        public static final int DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS
        Deprecated.
        The default minimum interval between time bar position updates.
        See Also:
        Constant Field Values
      • MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR

        public static final int MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR
        Deprecated.
        The maximum number of windows that can be shown in a multi-window time bar.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StyledPlayerControlView

        public StyledPlayerControlView​(Context context)
        Deprecated.
      • StyledPlayerControlView

        public StyledPlayerControlView​(Context context,
                                       @Nullable
                                       AttributeSet attrs)
        Deprecated.
      • StyledPlayerControlView

        public StyledPlayerControlView​(Context context,
                                       @Nullable
                                       AttributeSet attrs,
                                       int defStyleAttr)
        Deprecated.
      • StyledPlayerControlView

        public StyledPlayerControlView​(Context context,
                                       @Nullable
                                       AttributeSet attrs,
                                       int defStyleAttr,
                                       @Nullable
                                       AttributeSet playbackAttrs)
        Deprecated.
    • Method Detail

      • getPlayer

        @Nullable
        public Player getPlayer()
        Deprecated.
        Returns the Player currently being controlled by this view, or null if no player is set.
      • setPlayer

        public void setPlayer​(@Nullable
                              Player player)
        Deprecated.
        Sets the Player to control.
        Parameters:
        player - The Player to control, or null to detach the current player. Only players which are accessed on the main thread are supported ( player.getApplicationLooper() == Looper.getMainLooper()).
      • setShowMultiWindowTimeBar

        public void setShowMultiWindowTimeBar​(boolean showMultiWindowTimeBar)
        Deprecated.
        Sets whether the time bar should show all windows, as opposed to just the current one. If the timeline has a period with unknown duration or more than MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR windows the time bar will fall back to showing a single window.
        Parameters:
        showMultiWindowTimeBar - Whether the time bar should show all windows.
      • setExtraAdGroupMarkers

        public void setExtraAdGroupMarkers​(@Nullable
                                           long[] extraAdGroupTimesMs,
                                           @Nullable
                                           boolean[] extraPlayedAdGroups)
        Deprecated.
        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:
        extraAdGroupTimesMs - The millisecond timestamps of the extra ad markers to show, or null to show no extra ad markers.
        extraPlayedAdGroups - Whether each ad has been played. Must be the same length as extraAdGroupTimesMs, or null if extraAdGroupTimesMs is null.
      • setShowRewindButton

        public void setShowRewindButton​(boolean showRewindButton)
        Deprecated.
        Sets whether the rewind button is shown.
        Parameters:
        showRewindButton - Whether the rewind button is shown.
      • setShowFastForwardButton

        public void setShowFastForwardButton​(boolean showFastForwardButton)
        Deprecated.
        Sets whether the fast forward button is shown.
        Parameters:
        showFastForwardButton - Whether the fast forward button is shown.
      • setShowPreviousButton

        public void setShowPreviousButton​(boolean showPreviousButton)
        Deprecated.
        Sets whether the previous button is shown.
        Parameters:
        showPreviousButton - Whether the previous button is shown.
      • setShowNextButton

        public void setShowNextButton​(boolean showNextButton)
        Deprecated.
        Sets whether the next button is shown.
        Parameters:
        showNextButton - Whether the next button is shown.
      • getShowTimeoutMs

        public int getShowTimeoutMs()
        Deprecated.
        Returns the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input.
        Returns:
        The duration in milliseconds. A non-positive value indicates that the controls will remain visible indefinitely.
      • setShowTimeoutMs

        public void setShowTimeoutMs​(int showTimeoutMs)
        Deprecated.
        Sets the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input.
        Parameters:
        showTimeoutMs - The duration in milliseconds. A non-positive value will cause the controls to remain visible indefinitely.
      • getRepeatToggleModes

        @RepeatToggleModes
        public @com.google.android.exoplayer2.util.RepeatModeUtil.RepeatToggleModes int getRepeatToggleModes()
        Deprecated.
        Returns which repeat toggle modes are enabled.
        Returns:
        The currently enabled RepeatModeUtil.RepeatToggleModes.
      • setRepeatToggleModes

        public void setRepeatToggleModes​(@RepeatToggleModes
                                         @com.google.android.exoplayer2.util.RepeatModeUtil.RepeatToggleModes int repeatToggleModes)
        Deprecated.
        Sets which repeat toggle modes are enabled.
        Parameters:
        repeatToggleModes - A set of RepeatModeUtil.RepeatToggleModes.
      • getShowShuffleButton

        public boolean getShowShuffleButton()
        Deprecated.
        Returns whether the shuffle button is shown.
      • setShowShuffleButton

        public void setShowShuffleButton​(boolean showShuffleButton)
        Deprecated.
        Sets whether the shuffle button is shown.
        Parameters:
        showShuffleButton - Whether the shuffle button is shown.
      • getShowSubtitleButton

        public boolean getShowSubtitleButton()
        Deprecated.
        Returns whether the subtitle button is shown.
      • setShowSubtitleButton

        public void setShowSubtitleButton​(boolean showSubtitleButton)
        Deprecated.
        Sets whether the subtitle button is shown.
        Parameters:
        showSubtitleButton - Whether the subtitle button is shown.
      • getShowVrButton

        public boolean getShowVrButton()
        Deprecated.
        Returns whether the VR button is shown.
      • setShowVrButton

        public void setShowVrButton​(boolean showVrButton)
        Deprecated.
        Sets whether the VR button is shown.
        Parameters:
        showVrButton - Whether the VR button is shown.
      • setVrButtonListener

        public void setVrButtonListener​(@Nullable
                                        View.OnClickListener onClickListener)
        Deprecated.
        Sets listener for the VR button.
        Parameters:
        onClickListener - Listener for the VR button, or null to clear the listener.
      • setAnimationEnabled

        public void setAnimationEnabled​(boolean animationEnabled)
        Deprecated.
        Sets whether an animation is used to show and hide the playback controls.
        Parameters:
        animationEnabled - Whether an animation is applied to show and hide playback controls.
      • isAnimationEnabled

        public boolean isAnimationEnabled()
        Deprecated.
        Returns whether an animation is used to show and hide the playback controls.
      • setTimeBarMinUpdateInterval

        public void setTimeBarMinUpdateInterval​(int minUpdateIntervalMs)
        Deprecated.
        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:
        minUpdateIntervalMs - The minimum interval between time bar position updates, in milliseconds.
      • show

        public void show()
        Deprecated.
        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.
      • hide

        public void hide()
        Deprecated.
        Hides the controller.
      • hideImmediately

        public void hideImmediately()
        Deprecated.
        Hides the controller without any animation.
      • isFullyVisible

        public boolean isFullyVisible()
        Deprecated.
        Returns whether the controller is fully visible, which means all UI controls are visible.
      • isVisible

        public boolean isVisible()
        Deprecated.
        Returns whether the controller is currently visible.
      • dispatchMediaKeyEvent

        public boolean dispatchMediaKeyEvent​(KeyEvent event)
        Deprecated.
        Called to process media key events. Any KeyEvent can be passed but only media key events will be handled.
        Parameters:
        event - A key event.
        Returns:
        Whether the key event was handled.
      • onLayout

        protected void onLayout​(boolean changed,
                                int left,
                                int top,
                                int right,
                                int bottom)
        Deprecated.
        Overrides:
        onLayout in class FrameLayout