diff --git a/RELEASENOTES.md b/RELEASENOTES.md index c03ab052b7..33257e553b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -90,6 +90,14 @@ ensures programmatic changes to the `SubtitleView` will propagate down. * Add `setUseRewindAction` and `setUseFastForwardAction` to `PlayerNotificationManager`. + * Remove `rewind_increment` and `fastforward_increment` attributes from + `PlayerControlView` and `StyledPlayerControlView`. These increments can + be customized by configuring the `Player` (whenever possible) or by + using a `ForwardingPlayer` that overrides `getSeekBackIncrement`, + `seekBack`, `getSeekForwardIncrement` and `seekForward`. The + corresponding buttons can be disabled by using a `ForwardingPlayer` + that removes `COMMAND_SEEK_BACK` and `COMMAND_SEEK_FORWARD` from the + available commands. * Video: * Fix `IncorrectContextUseViolation` strict mode warning on Android 11 ([#8246](https://github.com/google/ExoPlayer/pull/8246)). diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java index 4d10bb1d98..14b22bba34 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java @@ -47,7 +47,6 @@ import android.widget.TextView; import androidx.annotation.Nullable; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ControlDispatcher; -import com.google.android.exoplayer2.DefaultControlDispatcher; import com.google.android.exoplayer2.ExoPlayerLibraryInfo; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player.Events; @@ -100,17 +99,6 @@ import java.util.concurrent.CopyOnWriteArrayList; *
  • Corresponding method: {@link #setShowNextButton(boolean)} *
  • Default: true * - *
  • {@code rewind_increment} - The duration of the rewind applied when the user taps the - * rewind button, in milliseconds. Use zero to disable the rewind button. - * - *
  • {@code fastforward_increment} - Like {@code rewind_increment}, but for fast forward. - * *
  • {@code repeat_toggle_modes} - A flagged enumeration value specifying which repeat * mode toggle options are enabled. Valid values are: {@code none}, {@code one}, {@code all}, * or {@code one|all}. @@ -383,17 +371,12 @@ public class PlayerControlView extends FrameLayout { showPreviousButton = true; showNextButton = true; showShuffleButton = false; - int rewindMs = DefaultControlDispatcher.DEFAULT_REWIND_MS; - int fastForwardMs = DefaultControlDispatcher.DEFAULT_FAST_FORWARD_MS; if (playbackAttrs != null) { TypedArray a = context .getTheme() .obtainStyledAttributes(playbackAttrs, R.styleable.PlayerControlView, 0, 0); try { - rewindMs = a.getInt(R.styleable.PlayerControlView_rewind_increment, rewindMs); - fastForwardMs = - a.getInt(R.styleable.PlayerControlView_fastforward_increment, fastForwardMs); showTimeoutMs = a.getInt(R.styleable.PlayerControlView_show_timeout, showTimeoutMs); controllerLayoutId = a.getResourceId(R.styleable.PlayerControlView_controller_layout_id, controllerLayoutId); @@ -427,8 +410,7 @@ public class PlayerControlView extends FrameLayout { extraAdGroupTimesMs = new long[0]; extraPlayedAdGroups = new boolean[0]; componentListener = new ComponentListener(); - controlDispatcher = - new com.google.android.exoplayer2.DefaultControlDispatcher(fastForwardMs, rewindMs); + controlDispatcher = new com.google.android.exoplayer2.DefaultControlDispatcher(); updateProgressAction = this::updateProgress; hideAction = this::hide; diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java index c368538cad..b89b32874c 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java @@ -122,17 +122,6 @@ import java.util.concurrent.CopyOnWriteArrayList; *
  • Corresponding method: {@link #setShowNextButton(boolean)} *
  • Default: true * - *
  • {@code rewind_increment} - The duration of the rewind applied when the user taps the - * rewind button, in milliseconds. Use zero to disable the rewind button. - * - *
  • {@code fastforward_increment} - Like {@code rewind_increment}, but for fast forward. - * *
  • {@code repeat_toggle_modes} - A flagged enumeration value specifying which repeat * mode toggle options are enabled. Valid values are: {@code none}, {@code one}, {@code all}, * or {@code one|all}. @@ -433,8 +422,6 @@ public class StyledPlayerControlView extends FrameLayout { private long[] extraAdGroupTimesMs; private boolean[] extraPlayedAdGroups; private long currentWindowOffset; - private long rewindMs; - private long fastForwardMs; private StyledPlayerControlViewLayoutManager controlViewLayoutManager; private Resources resources; @@ -484,8 +471,6 @@ public class StyledPlayerControlView extends FrameLayout { @Nullable AttributeSet playbackAttrs) { super(context, attrs, defStyleAttr); int controllerLayoutId = R.layout.exo_styled_player_control_view; - rewindMs = DefaultControlDispatcher.DEFAULT_REWIND_MS; - fastForwardMs = DefaultControlDispatcher.DEFAULT_FAST_FORWARD_MS; showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS; repeatToggleModes = DEFAULT_REPEAT_TOGGLE_MODES; timeBarMinUpdateIntervalMs = DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS; @@ -504,10 +489,6 @@ public class StyledPlayerControlView extends FrameLayout { .getTheme() .obtainStyledAttributes(playbackAttrs, R.styleable.StyledPlayerControlView, 0, 0); try { - rewindMs = a.getInt(R.styleable.StyledPlayerControlView_rewind_increment, (int) rewindMs); - fastForwardMs = - a.getInt( - R.styleable.StyledPlayerControlView_fastforward_increment, (int) fastForwardMs); controllerLayoutId = a.getResourceId( R.styleable.StyledPlayerControlView_controller_layout_id, controllerLayoutId); @@ -555,7 +536,7 @@ public class StyledPlayerControlView extends FrameLayout { playedAdGroups = new boolean[0]; extraAdGroupTimesMs = new long[0]; extraPlayedAdGroups = new boolean[0]; - controlDispatcher = new DefaultControlDispatcher(fastForwardMs, rewindMs); + controlDispatcher = new DefaultControlDispatcher(); updateProgressAction = this::updateProgress; durationView = findViewById(R.id.exo_duration); @@ -1160,9 +1141,10 @@ public class StyledPlayerControlView extends FrameLayout { } private void updateRewindButton() { - if (controlDispatcher instanceof DefaultControlDispatcher) { - rewindMs = ((DefaultControlDispatcher) controlDispatcher).getRewindIncrementMs(); - } + long rewindMs = + controlDispatcher instanceof DefaultControlDispatcher + ? ((DefaultControlDispatcher) controlDispatcher).getRewindIncrementMs() + : C.DEFAULT_SEEK_BACK_INCREMENT_MS; int rewindSec = (int) (rewindMs / 1_000); if (rewindButtonTextView != null) { rewindButtonTextView.setText(String.valueOf(rewindSec)); @@ -1175,9 +1157,10 @@ public class StyledPlayerControlView extends FrameLayout { } private void updateFastForwardButton() { - if (controlDispatcher instanceof DefaultControlDispatcher) { - fastForwardMs = ((DefaultControlDispatcher) controlDispatcher).getFastForwardIncrementMs(); - } + long fastForwardMs = + controlDispatcher instanceof DefaultControlDispatcher + ? ((DefaultControlDispatcher) controlDispatcher).getFastForwardIncrementMs() + : C.DEFAULT_SEEK_FORWARD_INCREMENT_MS; int fastForwardSec = (int) (fastForwardMs / 1_000); if (fastForwardButtonTextView != null) { fastForwardButtonTextView.setText(String.valueOf(fastForwardSec)); diff --git a/library/ui/src/main/res/values/attrs.xml b/library/ui/src/main/res/values/attrs.xml index bb4806db06..6121aa1402 100644 --- a/library/ui/src/main/res/values/attrs.xml +++ b/library/ui/src/main/res/values/attrs.xml @@ -58,8 +58,6 @@ - - @@ -109,8 +107,6 @@ - - @@ -147,8 +143,6 @@ - - @@ -179,8 +173,6 @@ - - @@ -208,8 +200,6 @@ - -