mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Deprecate ControlDispatcher in Leanback library
PiperOrigin-RevId: 385503851
This commit is contained in:
parent
fdc2cbd7e2
commit
30e65acf63
@ -102,10 +102,7 @@
|
||||
`getFastForwardIncrementMs` to take the player as parameter.
|
||||
* Deprecate `setControlDispatcher` in `PlayerView`, `StyledPlayerView`,
|
||||
`PlayerControlView`, `StyledPlayerControlView` and
|
||||
`PlayerNotificationManager`. Instead, you can use a `ForwardingPlayer`,
|
||||
configure the player as needed (whenever possible) or, for
|
||||
`PlayerNotificationManager`, use `setUseRewindAction` and
|
||||
`setUseFastForwardAction` to configure whether to use these actions.
|
||||
`PlayerNotificationManager`.
|
||||
* Video:
|
||||
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11
|
||||
([#8246](https://github.com/google/ExoPlayer/pull/8246)).
|
||||
@ -171,6 +168,8 @@
|
||||
* Cronet extension:
|
||||
* Add `CronetDataSource.Factory.setRequestPriority` to allow setting the
|
||||
priority of requests made by `CronetDataSource` instances.
|
||||
* Leanback:
|
||||
* Deprecate `setControlDispatcher` in `LeanbackPlayerAdapter`.
|
||||
|
||||
### 2.14.1 (2021-06-11)
|
||||
|
||||
|
@ -29,6 +29,7 @@ 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.ForwardingPlayer;
|
||||
import com.google.android.exoplayer2.PlaybackException;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Player.DiscontinuityReason;
|
||||
@ -76,11 +77,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ControlDispatcher}.
|
||||
*
|
||||
* @param controlDispatcher The {@link ControlDispatcher}, or null to use {@link
|
||||
* DefaultControlDispatcher}.
|
||||
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
|
||||
* customize some operations when configuring the player (for example by using {@code
|
||||
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
|
||||
*/
|
||||
@Deprecated
|
||||
public void setControlDispatcher(@Nullable ControlDispatcher controlDispatcher) {
|
||||
this.controlDispatcher =
|
||||
controlDispatcher == null ? new DefaultControlDispatcher() : controlDispatcher;
|
||||
@ -158,14 +159,16 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
} else if (player.getPlaybackState() == Player.STATE_ENDED) {
|
||||
controlDispatcher.dispatchSeekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET);
|
||||
}
|
||||
if (controlDispatcher.dispatchSetPlayWhenReady(player, true)) {
|
||||
if (player.isCommandAvailable(Player.COMMAND_PLAY_PAUSE)
|
||||
&& controlDispatcher.dispatchSetPlayWhenReady(player, true)) {
|
||||
getCallback().onPlayStateChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
if (controlDispatcher.dispatchSetPlayWhenReady(player, false)) {
|
||||
if (player.isCommandAvailable(Player.COMMAND_PLAY_PAUSE)
|
||||
&& controlDispatcher.dispatchSetPlayWhenReady(player, false)) {
|
||||
getCallback().onPlayStateChanged(this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user