Deprecate stop(boolean)

`stop(true)` is almost the same as `clearMediaItems(); stop();`, except that
any player error isn't cleared. Clearing media items more clearly expresses the
intent.

PiperOrigin-RevId: 350516748
This commit is contained in:
andrewlewis 2021-01-07 10:16:38 +00:00 committed by Ian Baker
parent 2c925a4109
commit 456622a275
4 changed files with 11 additions and 18 deletions

View File

@ -312,7 +312,8 @@ import java.util.ArrayList;
windowIndex = currentItemIndex;
}
}
previousPlayer.stop(true);
previousPlayer.stop();
previousPlayer.clearMediaItems();
}
this.currentPlayer = currentPlayer;

View File

@ -1219,8 +1219,7 @@ public interface Player {
/**
* Returns the error that caused playback to fail. This is the same error that will have been
* reported via {@link Player.EventListener#onPlayerError(ExoPlaybackException)} at the time of
* failure. It can be queried using this method until {@code stop(true)} is called or the player
* is re-prepared.
* failure. It can be queried using this method until the player is re-prepared.
*
* <p>Note that this method will always return {@code null} if {@link #getPlaybackState()} is not
* {@link #STATE_IDLE}.
@ -1405,16 +1404,11 @@ public interface Player {
void stop();
/**
* Stops playback and optionally clears the playlist and resets the position and playback error.
* Use {@link #pause()} rather than this method if the intention is to pause playback.
*
* <p>Calling this method will cause the playback state to transition to {@link #STATE_IDLE}. The
* player instance can still be used, and {@link #release()} must still be called on the player if
* it's no longer required.
*
* @param reset Whether the playlist should be cleared and whether the playback position and
* playback error should be reset.
* @deprecated Use {@link #stop()} and {@link #clearMediaItems()} (if {@code reset} is true) or
* just {@link #stop()} (if {@code reset} is false). Any player error will be cleared when
* {@link #prepare() re-preparing} the player.
*/
@Deprecated
void stop(boolean reset);
/**

View File

@ -737,9 +737,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
/**
* Sets whether the currently displayed video frame or media artwork is kept visible when the
* player is reset. A player reset is defined to mean the player being re-prepared with different
* media, the player transitioning to unprepared media, {@link Player#stop(boolean)} being called
* with {@code reset=true}, or the player being replaced or cleared by calling {@link
* #setPlayer(Player)}.
* media, the player transitioning to unprepared media or an empty list of media items, or the
* player being replaced or cleared by calling {@link #setPlayer(Player)}.
*
* <p>If enabled, the currently displayed video frame or media artwork will be kept visible until
* the player set on the view has been successfully prepared with new media and loaded enough of

View File

@ -733,9 +733,8 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro
/**
* Sets whether the currently displayed video frame or media artwork is kept visible when the
* player is reset. A player reset is defined to mean the player being re-prepared with different
* media, the player transitioning to unprepared media, {@link Player#stop(boolean)} being called
* with {@code reset=true}, or the player being replaced or cleared by calling {@link
* #setPlayer(Player)}.
* media, the player transitioning to unprepared media or an empty list of media items, or the
* player being replaced or cleared by calling {@link #setPlayer(Player)}.
*
* <p>If enabled, the currently displayed video frame or media artwork will be kept visible until
* the player set on the view has been successfully prepared with new media and loaded enough of