Remove deprecated PlaybackPreparer
PiperOrigin-RevId: 371170769
This commit is contained in:
parent
7d2a2aa283
commit
f7c4fd491b
@ -108,6 +108,15 @@
|
||||
* Remove `CastPlayer` specific playlist manipulation methods. Use
|
||||
`setMediaItems`, `addMediaItems`, `removeMediaItem` and `moveMediaItem`
|
||||
instead.
|
||||
* Remove `PlaybackPreparer`. UI components that previously had
|
||||
`setPlaybackPreparer` methods will now call `Player.prepare` by default.
|
||||
If this behavior is sufficient, use of `PlaybackPreparer` can be removed
|
||||
from application code without replacement. For custom preparation logic,
|
||||
replace calls to `setPlaybackPreparer` with calls to
|
||||
`setControlDispatcher` on the same components, passing a
|
||||
`ControlDispatcher` that implements custom preparation logic in
|
||||
`dispatchPrepare`. Extend `DefaultControlDispatcher` to avoid having to
|
||||
implement the other `ControlDispatcher` methods.
|
||||
* DRM:
|
||||
* Only dispatch DRM session acquire and release events once per period
|
||||
when playing content that uses the same encryption keys for both audio &
|
||||
|
@ -30,7 +30,6 @@ import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Player.DiscontinuityReason;
|
||||
import com.google.android.exoplayer2.Player.TimelineChangeReason;
|
||||
@ -51,7 +50,6 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
private final PlayerListener playerListener;
|
||||
private final int updatePeriodMs;
|
||||
|
||||
@Nullable private PlaybackPreparer playbackPreparer;
|
||||
private ControlDispatcher controlDispatcher;
|
||||
@Nullable private ErrorMessageProvider<? super ExoPlaybackException> errorMessageProvider;
|
||||
@Nullable private SurfaceHolderGlueHost surfaceHolderGlueHost;
|
||||
@ -76,20 +74,6 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
controlDispatcher = new DefaultControlDispatcher();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The adapter calls
|
||||
* {@link ControlDispatcher#dispatchPrepare(Player)} instead of {@link
|
||||
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the adapter
|
||||
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
|
||||
* you can provide a custom implementation of {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
|
||||
this.playbackPreparer = playbackPreparer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ControlDispatcher}.
|
||||
*
|
||||
@ -168,11 +152,7 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
@Override
|
||||
public void play() {
|
||||
if (player.getPlaybackState() == Player.STATE_IDLE) {
|
||||
if (playbackPreparer != null) {
|
||||
playbackPreparer.preparePlayback();
|
||||
} else {
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
}
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
} else if (player.getPlaybackState() == Player.STATE_ENDED) {
|
||||
controlDispatcher.dispatchSeekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET);
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ 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.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Player.Events;
|
||||
import com.google.android.exoplayer2.Player.State;
|
||||
@ -329,7 +328,6 @@ public class PlayerControlView extends FrameLayout {
|
||||
@Nullable private Player player;
|
||||
private com.google.android.exoplayer2.ControlDispatcher controlDispatcher;
|
||||
@Nullable private ProgressUpdateListener progressUpdateListener;
|
||||
@Nullable private PlaybackPreparer playbackPreparer;
|
||||
|
||||
private boolean isAttachedToWindow;
|
||||
private boolean showMultiWindowTimeBar;
|
||||
@ -616,20 +614,6 @@ public class PlayerControlView extends FrameLayout {
|
||||
this.progressUpdateListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
|
||||
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
|
||||
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
|
||||
* you can provide a custom implementation of {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
|
||||
this.playbackPreparer = playbackPreparer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link com.google.android.exoplayer2.ControlDispatcher}.
|
||||
*
|
||||
@ -1273,11 +1257,7 @@ public class PlayerControlView extends FrameLayout {
|
||||
private void dispatchPlay(Player player) {
|
||||
@State int state = player.getPlaybackState();
|
||||
if (state == Player.STATE_IDLE) {
|
||||
if (playbackPreparer != null) {
|
||||
playbackPreparer.preparePlayback();
|
||||
} else {
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
}
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
} else if (state == Player.STATE_ENDED) {
|
||||
seekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET);
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ import androidx.media.app.NotificationCompat.MediaStyle;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
import com.google.android.exoplayer2.util.NotificationUtil;
|
||||
@ -641,7 +640,6 @@ public class PlayerNotificationManager {
|
||||
@Nullable private NotificationCompat.Builder builder;
|
||||
@Nullable private List<NotificationCompat.Action> builderActions;
|
||||
@Nullable private Player player;
|
||||
@Nullable private PlaybackPreparer playbackPreparer;
|
||||
private ControlDispatcher controlDispatcher;
|
||||
private boolean isNotificationStarted;
|
||||
private int currentNotificationTag;
|
||||
@ -916,21 +914,6 @@ public class PlayerNotificationManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The manager calls
|
||||
* {@link ControlDispatcher#dispatchPrepare(Player)} instead of {@link
|
||||
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that this manager
|
||||
* uses by default, calls {@link Player#prepare()}. If you wish to intercept or customize this
|
||||
* behaviour, you can provide a custom implementation of {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)} and pass it to {@link
|
||||
* #setControlDispatcher(ControlDispatcher)}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
|
||||
this.playbackPreparer = playbackPreparer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ControlDispatcher}.
|
||||
*
|
||||
@ -1639,11 +1622,7 @@ public class PlayerNotificationManager {
|
||||
String action = intent.getAction();
|
||||
if (ACTION_PLAY.equals(action)) {
|
||||
if (player.getPlaybackState() == Player.STATE_IDLE) {
|
||||
if (playbackPreparer != null) {
|
||||
playbackPreparer.preparePlayback();
|
||||
} else {
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
}
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
} else if (player.getPlaybackState() == Player.STATE_ENDED) {
|
||||
controlDispatcher.dispatchSeekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET);
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Player.DiscontinuityReason;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
@ -913,21 +912,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
|
||||
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
|
||||
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
|
||||
* you can provide a custom implementation of {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
|
||||
Assertions.checkStateNotNull(controller);
|
||||
controller.setPlaybackPreparer(playbackPreparer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ControlDispatcher}.
|
||||
*
|
||||
|
@ -57,7 +57,6 @@ import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Player.Events;
|
||||
import com.google.android.exoplayer2.Player.State;
|
||||
@ -417,7 +416,6 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||
@Nullable private Player player;
|
||||
private ControlDispatcher controlDispatcher;
|
||||
@Nullable private ProgressUpdateListener progressUpdateListener;
|
||||
@Nullable private PlaybackPreparer playbackPreparer;
|
||||
|
||||
@Nullable private OnFullScreenModeChangedListener onFullScreenModeChangedListener;
|
||||
private boolean isFullScreen;
|
||||
@ -847,20 +845,6 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||
this.progressUpdateListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
|
||||
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
|
||||
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
|
||||
* you can provide a custom implementation of {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
|
||||
this.playbackPreparer = playbackPreparer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ControlDispatcher}.
|
||||
*
|
||||
@ -1702,11 +1686,7 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||
private void dispatchPlay(Player player) {
|
||||
@State int state = player.getPlaybackState();
|
||||
if (state == Player.STATE_IDLE) {
|
||||
if (playbackPreparer != null) {
|
||||
playbackPreparer.preparePlayback();
|
||||
} else {
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
}
|
||||
controlDispatcher.dispatchPrepare(player);
|
||||
} else if (state == Player.STATE_ENDED) {
|
||||
seekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET);
|
||||
}
|
||||
|
@ -48,9 +48,7 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Player.DiscontinuityReason;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
@ -930,21 +928,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
|
||||
controller.setOnFullScreenModeChangedListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
|
||||
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
|
||||
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
|
||||
* you can provide a custom implementation of {@link
|
||||
* ControlDispatcher#dispatchPrepare(Player)}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
|
||||
Assertions.checkStateNotNull(controller);
|
||||
controller.setPlaybackPreparer(playbackPreparer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ControlDispatcher}.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user