Commit 5153ccde by krocard Committed by bachinger

Remove release command for symmetry with Player construction

Release is a life cycle operation that should only be called when
the player is no longer needed. It's linked to the player lifecycle
and thus very different from prepare/stop.
As a result, it should not be in the same command.

Additionally it's not clear if remote players will ever need to call release,
as the player creator is best candidate to release it.

As a result the release operation doesn't have a use case for a command.
A release command can be added later if a need is identified.

PiperOrigin-RevId: 370649214
parent 45616f91
...@@ -89,7 +89,7 @@ public final class CastPlayer extends BasePlayer { ...@@ -89,7 +89,7 @@ public final class CastPlayer extends BasePlayer {
new Commands.Builder() new Commands.Builder()
.addAll( .addAll(
COMMAND_PLAY_PAUSE, COMMAND_PLAY_PAUSE,
COMMAND_PREPARE_STOP_RELEASE, COMMAND_PREPARE_STOP,
COMMAND_SEEK_TO_DEFAULT_POSITION, COMMAND_SEEK_TO_DEFAULT_POSITION,
COMMAND_SEEK_TO_MEDIA_ITEM, COMMAND_SEEK_TO_MEDIA_ITEM,
COMMAND_SET_REPEAT_MODE, COMMAND_SET_REPEAT_MODE,
......
...@@ -25,7 +25,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METAD ...@@ -25,7 +25,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METAD
import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT; import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT;
import static com.google.android.exoplayer2.Player.COMMAND_GET_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_GET_VOLUME;
import static com.google.android.exoplayer2.Player.COMMAND_PLAY_PAUSE; import static com.google.android.exoplayer2.Player.COMMAND_PLAY_PAUSE;
import static com.google.android.exoplayer2.Player.COMMAND_PREPARE_STOP_RELEASE; import static com.google.android.exoplayer2.Player.COMMAND_PREPARE_STOP;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_DEFAULT_POSITION; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_DEFAULT_POSITION;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_MEDIA_ITEM;
...@@ -1108,7 +1108,7 @@ public class CastPlayerTest { ...@@ -1108,7 +1108,7 @@ public class CastPlayerTest {
updateTimeLine(mediaItems, mediaQueueItemIds, /* currentItemId= */ 1); updateTimeLine(mediaItems, mediaQueueItemIds, /* currentItemId= */ 1);
assertThat(castPlayer.isCommandAvailable(COMMAND_PLAY_PAUSE)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_PLAY_PAUSE)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_PREPARE_STOP_RELEASE)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_PREPARE_STOP)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_SEEK_TO_DEFAULT_POSITION)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_SEEK_TO_DEFAULT_POSITION)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)).isTrue();
......
...@@ -938,7 +938,7 @@ public interface Player { ...@@ -938,7 +938,7 @@ public interface Player {
/** /**
* Commands that can be executed on a {@code Player}. One of {@link #COMMAND_PLAY_PAUSE}, {@link * Commands that can be executed on a {@code Player}. One of {@link #COMMAND_PLAY_PAUSE}, {@link
* #COMMAND_PREPARE_STOP_RELEASE}, {@link #COMMAND_SEEK_TO_DEFAULT_POSITION}, {@link * #COMMAND_PREPARE_STOP}, {@link #COMMAND_SEEK_TO_DEFAULT_POSITION}, {@link
* #COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM}, {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM}, {@link * #COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM}, {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM}, {@link
* #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM}, {@link #COMMAND_SEEK_TO_MEDIA_ITEM}, {@link * #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM}, {@link #COMMAND_SEEK_TO_MEDIA_ITEM}, {@link
* #COMMAND_SET_SPEED_AND_PITCH}, {@link #COMMAND_SET_SHUFFLE_MODE}, {@link * #COMMAND_SET_SPEED_AND_PITCH}, {@link #COMMAND_SET_SHUFFLE_MODE}, {@link
...@@ -953,7 +953,7 @@ public interface Player { ...@@ -953,7 +953,7 @@ public interface Player {
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({ @IntDef({
COMMAND_PLAY_PAUSE, COMMAND_PLAY_PAUSE,
COMMAND_PREPARE_STOP_RELEASE, COMMAND_PREPARE_STOP,
COMMAND_SEEK_TO_DEFAULT_POSITION, COMMAND_SEEK_TO_DEFAULT_POSITION,
COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM, COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM,
COMMAND_SEEK_TO_NEXT_MEDIA_ITEM, COMMAND_SEEK_TO_NEXT_MEDIA_ITEM,
...@@ -979,7 +979,7 @@ public interface Player { ...@@ -979,7 +979,7 @@ public interface Player {
/** Command to start, pause or resume playback. */ /** Command to start, pause or resume playback. */
int COMMAND_PLAY_PAUSE = 1; int COMMAND_PLAY_PAUSE = 1;
/** Command to prepare the player, stop playback or release the player. */ /** Command to prepare the player, stop playback or release the player. */
int COMMAND_PREPARE_STOP_RELEASE = 2; int COMMAND_PREPARE_STOP = 2;
/** Command to seek to the default position of the current window. */ /** Command to seek to the default position of the current window. */
int COMMAND_SEEK_TO_DEFAULT_POSITION = 3; int COMMAND_SEEK_TO_DEFAULT_POSITION = 3;
/** Command to seek anywhere into the current window. */ /** Command to seek anywhere into the current window. */
......
...@@ -192,7 +192,7 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -192,7 +192,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
new Commands.Builder() new Commands.Builder()
.addAll( .addAll(
COMMAND_PLAY_PAUSE, COMMAND_PLAY_PAUSE,
COMMAND_PREPARE_STOP_RELEASE, COMMAND_PREPARE_STOP,
COMMAND_SET_SPEED_AND_PITCH, COMMAND_SET_SPEED_AND_PITCH,
COMMAND_SET_SHUFFLE_MODE, COMMAND_SET_SHUFFLE_MODE,
COMMAND_SET_REPEAT_MODE, COMMAND_SET_REPEAT_MODE,
......
...@@ -25,7 +25,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METAD ...@@ -25,7 +25,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METAD
import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT; import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT;
import static com.google.android.exoplayer2.Player.COMMAND_GET_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_GET_VOLUME;
import static com.google.android.exoplayer2.Player.COMMAND_PLAY_PAUSE; import static com.google.android.exoplayer2.Player.COMMAND_PLAY_PAUSE;
import static com.google.android.exoplayer2.Player.COMMAND_PREPARE_STOP_RELEASE; import static com.google.android.exoplayer2.Player.COMMAND_PREPARE_STOP;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_DEFAULT_POSITION; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_DEFAULT_POSITION;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_MEDIA_ITEM;
...@@ -8074,7 +8074,7 @@ public final class ExoPlayerTest { ...@@ -8074,7 +8074,7 @@ public final class ExoPlayerTest {
player.addMediaSources(ImmutableList.of(new FakeMediaSource(), new FakeMediaSource())); player.addMediaSources(ImmutableList.of(new FakeMediaSource(), new FakeMediaSource()));
assertThat(player.isCommandAvailable(COMMAND_PLAY_PAUSE)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_PLAY_PAUSE)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_PREPARE_STOP_RELEASE)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_PREPARE_STOP)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_SEEK_TO_DEFAULT_POSITION)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_SEEK_TO_DEFAULT_POSITION)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM)).isFalse(); assertThat(player.isCommandAvailable(COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM)).isFalse();
assertThat(player.isCommandAvailable(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)).isTrue();
...@@ -10269,7 +10269,7 @@ public final class ExoPlayerTest { ...@@ -10269,7 +10269,7 @@ public final class ExoPlayerTest {
Player.Commands.Builder builder = new Player.Commands.Builder(); Player.Commands.Builder builder = new Player.Commands.Builder();
builder.addAll( builder.addAll(
COMMAND_PLAY_PAUSE, COMMAND_PLAY_PAUSE,
COMMAND_PREPARE_STOP_RELEASE, COMMAND_PREPARE_STOP,
COMMAND_SET_SPEED_AND_PITCH, COMMAND_SET_SPEED_AND_PITCH,
COMMAND_SET_SHUFFLE_MODE, COMMAND_SET_SHUFFLE_MODE,
COMMAND_SET_REPEAT_MODE, COMMAND_SET_REPEAT_MODE,
......
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