Commit b3788ce5 by tonihei Committed by Tianyi Feng

Remove deprecated stop(boolean)

This method has been deprecated for over 2 years.

PiperOrigin-RevId: 520586238
parent f4a3478d
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
* Remove `DefaultAudioSink` constructors, use `DefaultAudioSink.Builder` * Remove `DefaultAudioSink` constructors, use `DefaultAudioSink.Builder`
instead. instead.
* Remove `HlsMasterPlaylist`, use `HlsMultivariantPlaylist` instead. * Remove `HlsMasterPlaylist`, use `HlsMultivariantPlaylist` instead.
* Remove `Player.stop(boolean)`. Use `Player.stop()` and
`Player.clearMediaItems()` (if `reset` is `true`) instead.
### 1.0.0 (2023-03-22) ### 1.0.0 (2023-03-22)
......
...@@ -477,17 +477,6 @@ public final class CastPlayer extends BasePlayer { ...@@ -477,17 +477,6 @@ public final class CastPlayer extends BasePlayer {
@Override @Override
public void stop() { public void stop() {
stop(/* reset= */ false);
}
/**
* @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
@Override
public void stop(boolean reset) {
playbackState = STATE_IDLE; playbackState = STATE_IDLE;
if (remoteMediaClient != null) { if (remoteMediaClient != null) {
// TODO(b/69792021): Support or emulate stop without position reset. // TODO(b/69792021): Support or emulate stop without position reset.
......
...@@ -478,20 +478,6 @@ public class ForwardingPlayer implements Player { ...@@ -478,20 +478,6 @@ public class ForwardingPlayer implements Player {
player.stop(); player.stop();
} }
/**
* Calls {@link Player#stop(boolean)} on the delegate.
*
* @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.
*/
@SuppressWarnings("deprecation") // Forwarding to deprecated method
@Deprecated
@Override
public void stop(boolean reset) {
player.stop(reset);
}
/** Calls {@link Player#release()} on the delegate. */ /** Calls {@link Player#release()} on the delegate. */
@Override @Override
public void release() { public void release() {
......
...@@ -2525,15 +2525,6 @@ public interface Player { ...@@ -2525,15 +2525,6 @@ public interface Player {
void stop(); void stop();
/** /**
* @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.
*/
@UnstableApi
@Deprecated
void stop(boolean reset);
/**
* Releases the player. This method must be called when the player is no longer required. The * Releases the player. This method must be called when the player is no longer required. The
* player must not be used after calling this method. * player must not be used after calling this method.
* *
......
...@@ -2326,14 +2326,6 @@ public abstract class SimpleBasePlayer extends BasePlayer { ...@@ -2326,14 +2326,6 @@ public abstract class SimpleBasePlayer extends BasePlayer {
} }
@Override @Override
public final void stop(boolean reset) {
stop();
if (reset) {
clearMediaItems();
}
}
@Override
public final void release() { public final void release() {
verifyApplicationThreadAndInitState(); verifyApplicationThreadAndInitState();
// Use a local copy to ensure the lambda below uses the current state value. // Use a local copy to ensure the lambda below uses the current state value.
......
...@@ -956,7 +956,6 @@ import java.util.concurrent.TimeoutException; ...@@ -956,7 +956,6 @@ import java.util.concurrent.TimeoutException;
if (!internalPlayer.setForegroundMode(foregroundMode)) { if (!internalPlayer.setForegroundMode(foregroundMode)) {
// One of the renderers timed out releasing its resources. // One of the renderers timed out releasing its resources.
stopInternal( stopInternal(
/* reset= */ false,
ExoPlaybackException.createForUnexpected( ExoPlaybackException.createForUnexpected(
new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE), new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE),
PlaybackException.ERROR_CODE_TIMEOUT)); PlaybackException.ERROR_CODE_TIMEOUT));
...@@ -967,14 +966,8 @@ import java.util.concurrent.TimeoutException; ...@@ -967,14 +966,8 @@ import java.util.concurrent.TimeoutException;
@Override @Override
public void stop() { public void stop() {
verifyApplicationThread(); verifyApplicationThread();
stop(/* reset= */ false);
}
@Override
public void stop(boolean reset) {
verifyApplicationThread();
audioFocusManager.updateAudioFocus(getPlayWhenReady(), Player.STATE_IDLE); audioFocusManager.updateAudioFocus(getPlayWhenReady(), Player.STATE_IDLE);
stopInternal(reset, /* error= */ null); stopInternal(/* error= */ null);
currentCueGroup = new CueGroup(ImmutableList.of(), playbackInfo.positionUs); currentCueGroup = new CueGroup(ImmutableList.of(), playbackInfo.positionUs);
} }
...@@ -1759,38 +1752,27 @@ import java.util.concurrent.TimeoutException; ...@@ -1759,38 +1752,27 @@ import java.util.concurrent.TimeoutException;
/** /**
* Stops the player. * Stops the player.
* *
* @param reset Whether the playlist should be cleared and whether the playback position and
* playback error should be reset.
* @param error An optional {@link ExoPlaybackException} to set. * @param error An optional {@link ExoPlaybackException} to set.
*/ */
private void stopInternal(boolean reset, @Nullable ExoPlaybackException error) { private void stopInternal(@Nullable ExoPlaybackException error) {
PlaybackInfo playbackInfo; PlaybackInfo playbackInfo =
if (reset) { this.playbackInfo.copyWithLoadingMediaPeriodId(this.playbackInfo.periodId);
playbackInfo =
removeMediaItemsInternal(
/* fromIndex= */ 0, /* toIndex= */ mediaSourceHolderSnapshots.size());
playbackInfo = playbackInfo.copyWithPlaybackError(null);
} else {
playbackInfo = this.playbackInfo.copyWithLoadingMediaPeriodId(this.playbackInfo.periodId);
playbackInfo.bufferedPositionUs = playbackInfo.positionUs; playbackInfo.bufferedPositionUs = playbackInfo.positionUs;
playbackInfo.totalBufferedDurationUs = 0; playbackInfo.totalBufferedDurationUs = 0;
}
playbackInfo = playbackInfo.copyWithPlaybackState(Player.STATE_IDLE); playbackInfo = playbackInfo.copyWithPlaybackState(Player.STATE_IDLE);
if (error != null) { if (error != null) {
playbackInfo = playbackInfo.copyWithPlaybackError(error); playbackInfo = playbackInfo.copyWithPlaybackError(error);
} }
pendingOperationAcks++; pendingOperationAcks++;
internalPlayer.stop(); internalPlayer.stop();
boolean positionDiscontinuity =
playbackInfo.timeline.isEmpty() && !this.playbackInfo.timeline.isEmpty();
updatePlaybackInfo( updatePlaybackInfo(
playbackInfo, playbackInfo,
TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, /* ignored */ TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED,
/* ignored */ PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST, /* ignored */ PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
/* seekProcessed= */ false, /* seekProcessed= */ false,
positionDiscontinuity, /* positionDiscontinuity= */ false,
DISCONTINUITY_REASON_REMOVE, /* ignored */ DISCONTINUITY_REASON_INTERNAL,
/* discontinuityWindowStartPositionUs= */ getCurrentPositionUsInternal(playbackInfo), /* ignored */ C.TIME_UNSET,
/* ignored */ C.INDEX_UNSET, /* ignored */ C.INDEX_UNSET,
/* repeatCurrentMediaItem= */ false); /* repeatCurrentMediaItem= */ false);
} }
...@@ -2589,7 +2571,6 @@ import java.util.concurrent.TimeoutException; ...@@ -2589,7 +2571,6 @@ import java.util.concurrent.TimeoutException;
this.videoOutput = videoOutput; this.videoOutput = videoOutput;
if (messageDeliveryTimedOut) { if (messageDeliveryTimedOut) {
stopInternal( stopInternal(
/* reset= */ false,
ExoPlaybackException.createForUnexpected( ExoPlaybackException.createForUnexpected(
new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_DETACH_SURFACE), new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_DETACH_SURFACE),
PlaybackException.ERROR_CODE_TIMEOUT)); PlaybackException.ERROR_CODE_TIMEOUT));
......
...@@ -1079,18 +1079,6 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1079,18 +1079,6 @@ public class SimpleExoPlayer extends BasePlayer
player.stop(); player.stop();
} }
/**
* @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
@Override
public void stop(boolean reset) {
blockUntilConstructorFinished();
player.stop(reset);
}
@Override @Override
public void release() { public void release() {
blockUntilConstructorFinished(); blockUntilConstructorFinished();
......
...@@ -471,21 +471,6 @@ public class MediaController implements Player { ...@@ -471,21 +471,6 @@ public class MediaController implements Player {
} }
/** /**
* @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.
*/
@UnstableApi
@Deprecated
@Override
public void stop(boolean reset) {
stop();
if (reset) {
clearMediaItems();
}
}
/**
* Releases the connection between {@link MediaController} and {@link MediaSession}. This method * Releases the connection between {@link MediaController} and {@link MediaSession}. This method
* must be called when the controller is no longer required. The controller must not be used after * must be called when the controller is no longer required. The controller must not be used after
* calling this method. * calling this method.
......
...@@ -314,17 +314,6 @@ public class MockPlayer implements Player { ...@@ -314,17 +314,6 @@ public class MockPlayer implements Player {
checkNotNull(conditionVariables.get(METHOD_STOP)).open(); checkNotNull(conditionVariables.get(METHOD_STOP)).open();
} }
/**
* @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
@Override
public void stop(boolean reset) {
throw new UnsupportedOperationException();
}
@Override @Override
public void addListener(Listener listener) { public void addListener(Listener listener) {
listeners.add(listener); listeners.add(listener);
......
...@@ -339,13 +339,11 @@ public abstract class Action { ...@@ -339,13 +339,11 @@ public abstract class Action {
} }
} }
/** Calls {@link Player#stop()} or {@link Player#stop(boolean)}. */ /** Calls {@link Player#stop()}. */
public static final class Stop extends Action { public static final class Stop extends Action {
private static final String STOP_ACTION_TAG = "Stop"; private static final String STOP_ACTION_TAG = "Stop";
@Nullable private final Boolean reset;
/** /**
* Action will call {@link Player#stop()}. * Action will call {@link Player#stop()}.
* *
...@@ -353,28 +351,12 @@ public abstract class Action { ...@@ -353,28 +351,12 @@ public abstract class Action {
*/ */
public Stop(String tag) { public Stop(String tag) {
super(tag, STOP_ACTION_TAG); super(tag, STOP_ACTION_TAG);
this.reset = null;
}
/**
* Action will call {@link Player#stop(boolean)}.
*
* @param tag A tag to use for logging.
* @param reset The value to pass to {@link Player#stop(boolean)}.
*/
public Stop(@Size(max = 23) String tag, boolean reset) {
super(tag, STOP_ACTION_TAG);
this.reset = reset;
} }
@Override @Override
protected void doActionImpl( protected void doActionImpl(
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
if (reset == null) {
player.stop(); player.stop();
} else {
player.stop(reset);
}
} }
} }
......
...@@ -243,17 +243,6 @@ public final class ActionSchedule { ...@@ -243,17 +243,6 @@ public final class ActionSchedule {
} }
/** /**
* Schedules a stop action.
*
* @param reset Whether the player should be reset.
* @return The builder, for convenience.
*/
@CanIgnoreReturnValue
public Builder stop(boolean reset) {
return apply(new Stop(tag, reset));
}
/**
* Schedules a play action. * Schedules a play action.
* *
* @return The builder, for convenience. * @return The builder, for convenience.
......
...@@ -185,17 +185,6 @@ public class StubPlayer extends BasePlayer { ...@@ -185,17 +185,6 @@ public class StubPlayer extends BasePlayer {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/**
* @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
@Override
public void stop(boolean reset) {
throw new UnsupportedOperationException();
}
@Override @Override
public void release() { public void release() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment