mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove fastforward_increment and rewind_increment attributes
This values won't be configurable from the UI anymore once the DefaultControlDispatcher is removed. They can be configured in the Player or by using a ForwardingPlayer. PiperOrigin-RevId: 385113498
This commit is contained in:
parent
227f9a3b93
commit
626c3e9843
4 changed files with 18 additions and 55 deletions
|
|
@ -90,6 +90,14 @@
|
||||||
ensures programmatic changes to the `SubtitleView` will propagate down.
|
ensures programmatic changes to the `SubtitleView` will propagate down.
|
||||||
* Add `setUseRewindAction` and `setUseFastForwardAction` to
|
* Add `setUseRewindAction` and `setUseFastForwardAction` to
|
||||||
`PlayerNotificationManager`.
|
`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:
|
* Video:
|
||||||
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11
|
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11
|
||||||
([#8246](https://github.com/google/ExoPlayer/pull/8246)).
|
([#8246](https://github.com/google/ExoPlayer/pull/8246)).
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ControlDispatcher;
|
import com.google.android.exoplayer2.ControlDispatcher;
|
||||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
|
||||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Player.Events;
|
import com.google.android.exoplayer2.Player.Events;
|
||||||
|
|
@ -100,17 +99,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
* <li>Corresponding method: {@link #setShowNextButton(boolean)}
|
* <li>Corresponding method: {@link #setShowNextButton(boolean)}
|
||||||
* <li>Default: true
|
* <li>Default: true
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li><b>{@code rewind_increment}</b> - The duration of the rewind applied when the user taps the
|
|
||||||
* rewind button, in milliseconds. Use zero to disable the rewind button.
|
|
||||||
* <ul>
|
|
||||||
* <li>Corresponding method: {@link #setControlDispatcher(ControlDispatcher)}
|
|
||||||
* <li>Default: {@link DefaultControlDispatcher#DEFAULT_REWIND_MS}
|
|
||||||
* </ul>
|
|
||||||
* <li><b>{@code fastforward_increment}</b> - Like {@code rewind_increment}, but for fast forward.
|
|
||||||
* <ul>
|
|
||||||
* <li>Corresponding method: {@link #setControlDispatcher(ControlDispatcher)}
|
|
||||||
* <li>Default: {@link DefaultControlDispatcher#DEFAULT_FAST_FORWARD_MS}
|
|
||||||
* </ul>
|
|
||||||
* <li><b>{@code repeat_toggle_modes}</b> - A flagged enumeration value specifying which repeat
|
* <li><b>{@code repeat_toggle_modes}</b> - A flagged enumeration value specifying which repeat
|
||||||
* mode toggle options are enabled. Valid values are: {@code none}, {@code one}, {@code all},
|
* mode toggle options are enabled. Valid values are: {@code none}, {@code one}, {@code all},
|
||||||
* or {@code one|all}.
|
* or {@code one|all}.
|
||||||
|
|
@ -383,17 +371,12 @@ public class PlayerControlView extends FrameLayout {
|
||||||
showPreviousButton = true;
|
showPreviousButton = true;
|
||||||
showNextButton = true;
|
showNextButton = true;
|
||||||
showShuffleButton = false;
|
showShuffleButton = false;
|
||||||
int rewindMs = DefaultControlDispatcher.DEFAULT_REWIND_MS;
|
|
||||||
int fastForwardMs = DefaultControlDispatcher.DEFAULT_FAST_FORWARD_MS;
|
|
||||||
if (playbackAttrs != null) {
|
if (playbackAttrs != null) {
|
||||||
TypedArray a =
|
TypedArray a =
|
||||||
context
|
context
|
||||||
.getTheme()
|
.getTheme()
|
||||||
.obtainStyledAttributes(playbackAttrs, R.styleable.PlayerControlView, 0, 0);
|
.obtainStyledAttributes(playbackAttrs, R.styleable.PlayerControlView, 0, 0);
|
||||||
try {
|
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);
|
showTimeoutMs = a.getInt(R.styleable.PlayerControlView_show_timeout, showTimeoutMs);
|
||||||
controllerLayoutId =
|
controllerLayoutId =
|
||||||
a.getResourceId(R.styleable.PlayerControlView_controller_layout_id, controllerLayoutId);
|
a.getResourceId(R.styleable.PlayerControlView_controller_layout_id, controllerLayoutId);
|
||||||
|
|
@ -427,8 +410,7 @@ public class PlayerControlView extends FrameLayout {
|
||||||
extraAdGroupTimesMs = new long[0];
|
extraAdGroupTimesMs = new long[0];
|
||||||
extraPlayedAdGroups = new boolean[0];
|
extraPlayedAdGroups = new boolean[0];
|
||||||
componentListener = new ComponentListener();
|
componentListener = new ComponentListener();
|
||||||
controlDispatcher =
|
controlDispatcher = new com.google.android.exoplayer2.DefaultControlDispatcher();
|
||||||
new com.google.android.exoplayer2.DefaultControlDispatcher(fastForwardMs, rewindMs);
|
|
||||||
updateProgressAction = this::updateProgress;
|
updateProgressAction = this::updateProgress;
|
||||||
hideAction = this::hide;
|
hideAction = this::hide;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,17 +122,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
* <li>Corresponding method: {@link #setShowNextButton(boolean)}
|
* <li>Corresponding method: {@link #setShowNextButton(boolean)}
|
||||||
* <li>Default: true
|
* <li>Default: true
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li><b>{@code rewind_increment}</b> - The duration of the rewind applied when the user taps the
|
|
||||||
* rewind button, in milliseconds. Use zero to disable the rewind button.
|
|
||||||
* <ul>
|
|
||||||
* <li>Corresponding method: {@link #setControlDispatcher(ControlDispatcher)}
|
|
||||||
* <li>Default: {@link DefaultControlDispatcher#DEFAULT_REWIND_MS}
|
|
||||||
* </ul>
|
|
||||||
* <li><b>{@code fastforward_increment}</b> - Like {@code rewind_increment}, but for fast forward.
|
|
||||||
* <ul>
|
|
||||||
* <li>Corresponding method: {@link #setControlDispatcher(ControlDispatcher)}
|
|
||||||
* <li>Default: {@link DefaultControlDispatcher#DEFAULT_FAST_FORWARD_MS}
|
|
||||||
* </ul>
|
|
||||||
* <li><b>{@code repeat_toggle_modes}</b> - A flagged enumeration value specifying which repeat
|
* <li><b>{@code repeat_toggle_modes}</b> - A flagged enumeration value specifying which repeat
|
||||||
* mode toggle options are enabled. Valid values are: {@code none}, {@code one}, {@code all},
|
* mode toggle options are enabled. Valid values are: {@code none}, {@code one}, {@code all},
|
||||||
* or {@code one|all}.
|
* or {@code one|all}.
|
||||||
|
|
@ -433,8 +422,6 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||||
private long[] extraAdGroupTimesMs;
|
private long[] extraAdGroupTimesMs;
|
||||||
private boolean[] extraPlayedAdGroups;
|
private boolean[] extraPlayedAdGroups;
|
||||||
private long currentWindowOffset;
|
private long currentWindowOffset;
|
||||||
private long rewindMs;
|
|
||||||
private long fastForwardMs;
|
|
||||||
|
|
||||||
private StyledPlayerControlViewLayoutManager controlViewLayoutManager;
|
private StyledPlayerControlViewLayoutManager controlViewLayoutManager;
|
||||||
private Resources resources;
|
private Resources resources;
|
||||||
|
|
@ -484,8 +471,6 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||||
@Nullable AttributeSet playbackAttrs) {
|
@Nullable AttributeSet playbackAttrs) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
int controllerLayoutId = R.layout.exo_styled_player_control_view;
|
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;
|
showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;
|
||||||
repeatToggleModes = DEFAULT_REPEAT_TOGGLE_MODES;
|
repeatToggleModes = DEFAULT_REPEAT_TOGGLE_MODES;
|
||||||
timeBarMinUpdateIntervalMs = DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS;
|
timeBarMinUpdateIntervalMs = DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS;
|
||||||
|
|
@ -504,10 +489,6 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||||
.getTheme()
|
.getTheme()
|
||||||
.obtainStyledAttributes(playbackAttrs, R.styleable.StyledPlayerControlView, 0, 0);
|
.obtainStyledAttributes(playbackAttrs, R.styleable.StyledPlayerControlView, 0, 0);
|
||||||
try {
|
try {
|
||||||
rewindMs = a.getInt(R.styleable.StyledPlayerControlView_rewind_increment, (int) rewindMs);
|
|
||||||
fastForwardMs =
|
|
||||||
a.getInt(
|
|
||||||
R.styleable.StyledPlayerControlView_fastforward_increment, (int) fastForwardMs);
|
|
||||||
controllerLayoutId =
|
controllerLayoutId =
|
||||||
a.getResourceId(
|
a.getResourceId(
|
||||||
R.styleable.StyledPlayerControlView_controller_layout_id, controllerLayoutId);
|
R.styleable.StyledPlayerControlView_controller_layout_id, controllerLayoutId);
|
||||||
|
|
@ -555,7 +536,7 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||||
playedAdGroups = new boolean[0];
|
playedAdGroups = new boolean[0];
|
||||||
extraAdGroupTimesMs = new long[0];
|
extraAdGroupTimesMs = new long[0];
|
||||||
extraPlayedAdGroups = new boolean[0];
|
extraPlayedAdGroups = new boolean[0];
|
||||||
controlDispatcher = new DefaultControlDispatcher(fastForwardMs, rewindMs);
|
controlDispatcher = new DefaultControlDispatcher();
|
||||||
updateProgressAction = this::updateProgress;
|
updateProgressAction = this::updateProgress;
|
||||||
|
|
||||||
durationView = findViewById(R.id.exo_duration);
|
durationView = findViewById(R.id.exo_duration);
|
||||||
|
|
@ -1160,9 +1141,10 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRewindButton() {
|
private void updateRewindButton() {
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
long rewindMs =
|
||||||
rewindMs = ((DefaultControlDispatcher) controlDispatcher).getRewindIncrementMs();
|
controlDispatcher instanceof DefaultControlDispatcher
|
||||||
}
|
? ((DefaultControlDispatcher) controlDispatcher).getRewindIncrementMs()
|
||||||
|
: C.DEFAULT_SEEK_BACK_INCREMENT_MS;
|
||||||
int rewindSec = (int) (rewindMs / 1_000);
|
int rewindSec = (int) (rewindMs / 1_000);
|
||||||
if (rewindButtonTextView != null) {
|
if (rewindButtonTextView != null) {
|
||||||
rewindButtonTextView.setText(String.valueOf(rewindSec));
|
rewindButtonTextView.setText(String.valueOf(rewindSec));
|
||||||
|
|
@ -1175,9 +1157,10 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFastForwardButton() {
|
private void updateFastForwardButton() {
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
long fastForwardMs =
|
||||||
fastForwardMs = ((DefaultControlDispatcher) controlDispatcher).getFastForwardIncrementMs();
|
controlDispatcher instanceof DefaultControlDispatcher
|
||||||
}
|
? ((DefaultControlDispatcher) controlDispatcher).getFastForwardIncrementMs()
|
||||||
|
: C.DEFAULT_SEEK_FORWARD_INCREMENT_MS;
|
||||||
int fastForwardSec = (int) (fastForwardMs / 1_000);
|
int fastForwardSec = (int) (fastForwardMs / 1_000);
|
||||||
if (fastForwardButtonTextView != null) {
|
if (fastForwardButtonTextView != null) {
|
||||||
fastForwardButtonTextView.setText(String.valueOf(fastForwardSec));
|
fastForwardButtonTextView.setText(String.valueOf(fastForwardSec));
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,6 @@
|
||||||
|
|
||||||
<!-- PlayerControlView and StyledPlayerControlView attributes -->
|
<!-- PlayerControlView and StyledPlayerControlView attributes -->
|
||||||
<attr name="show_timeout" format="integer"/>
|
<attr name="show_timeout" format="integer"/>
|
||||||
<attr name="rewind_increment" format="integer"/>
|
|
||||||
<attr name="fastforward_increment" format="integer"/>
|
|
||||||
<attr name="show_rewind_button" format="boolean"/>
|
<attr name="show_rewind_button" format="boolean"/>
|
||||||
<attr name="show_fastforward_button" format="boolean"/>
|
<attr name="show_fastforward_button" format="boolean"/>
|
||||||
<attr name="show_previous_button" format="boolean"/>
|
<attr name="show_previous_button" format="boolean"/>
|
||||||
|
|
@ -109,8 +107,6 @@
|
||||||
<attr name="resize_mode"/>
|
<attr name="resize_mode"/>
|
||||||
<!-- PlayerControlView attributes -->
|
<!-- PlayerControlView attributes -->
|
||||||
<attr name="show_timeout"/>
|
<attr name="show_timeout"/>
|
||||||
<attr name="rewind_increment"/>
|
|
||||||
<attr name="fastforward_increment"/>
|
|
||||||
<attr name="repeat_toggle_modes"/>
|
<attr name="repeat_toggle_modes"/>
|
||||||
<attr name="show_shuffle_button"/>
|
<attr name="show_shuffle_button"/>
|
||||||
<attr name="time_bar_min_update_interval"/>
|
<attr name="time_bar_min_update_interval"/>
|
||||||
|
|
@ -147,8 +143,6 @@
|
||||||
<attr name="resize_mode"/>
|
<attr name="resize_mode"/>
|
||||||
<!-- PlayerControlView attributes -->
|
<!-- PlayerControlView attributes -->
|
||||||
<attr name="show_timeout"/>
|
<attr name="show_timeout"/>
|
||||||
<attr name="rewind_increment"/>
|
|
||||||
<attr name="fastforward_increment"/>
|
|
||||||
<attr name="repeat_toggle_modes"/>
|
<attr name="repeat_toggle_modes"/>
|
||||||
<attr name="show_shuffle_button"/>
|
<attr name="show_shuffle_button"/>
|
||||||
<attr name="show_subtitle_button"/>
|
<attr name="show_subtitle_button"/>
|
||||||
|
|
@ -179,8 +173,6 @@
|
||||||
|
|
||||||
<declare-styleable name="PlayerControlView">
|
<declare-styleable name="PlayerControlView">
|
||||||
<attr name="show_timeout"/>
|
<attr name="show_timeout"/>
|
||||||
<attr name="rewind_increment"/>
|
|
||||||
<attr name="fastforward_increment"/>
|
|
||||||
<attr name="repeat_toggle_modes"/>
|
<attr name="repeat_toggle_modes"/>
|
||||||
<attr name="show_rewind_button"/>
|
<attr name="show_rewind_button"/>
|
||||||
<attr name="show_fastforward_button"/>
|
<attr name="show_fastforward_button"/>
|
||||||
|
|
@ -208,8 +200,6 @@
|
||||||
|
|
||||||
<declare-styleable name="StyledPlayerControlView">
|
<declare-styleable name="StyledPlayerControlView">
|
||||||
<attr name="show_timeout"/>
|
<attr name="show_timeout"/>
|
||||||
<attr name="rewind_increment"/>
|
|
||||||
<attr name="fastforward_increment"/>
|
|
||||||
<attr name="repeat_toggle_modes"/>
|
<attr name="repeat_toggle_modes"/>
|
||||||
<attr name="show_rewind_button"/>
|
<attr name="show_rewind_button"/>
|
||||||
<attr name="show_fastforward_button"/>
|
<attr name="show_fastforward_button"/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue