Clean imports in MediaControllerImplLegacy
Remove static imports to constants and imports to intdefs, to make the code more readable. PiperOrigin-RevId: 485592288
This commit is contained in:
parent
40b5cba3c8
commit
8db6b71805
@ -15,29 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.session;
|
package androidx.media3.session;
|
||||||
|
|
||||||
import static android.support.v4.media.MediaMetadataCompat.METADATA_KEY_MEDIA_ID;
|
|
||||||
import static androidx.media3.common.Player.DISCONTINUITY_REASON_SEEK;
|
|
||||||
import static androidx.media3.common.Player.EVENT_IS_PLAYING_CHANGED;
|
|
||||||
import static androidx.media3.common.Player.EVENT_MEDIA_ITEM_TRANSITION;
|
|
||||||
import static androidx.media3.common.Player.EVENT_MEDIA_METADATA_CHANGED;
|
|
||||||
import static androidx.media3.common.Player.EVENT_PLAYBACK_PARAMETERS_CHANGED;
|
|
||||||
import static androidx.media3.common.Player.EVENT_PLAYBACK_STATE_CHANGED;
|
|
||||||
import static androidx.media3.common.Player.EVENT_PLAYER_ERROR;
|
|
||||||
import static androidx.media3.common.Player.EVENT_PLAY_WHEN_READY_CHANGED;
|
|
||||||
import static androidx.media3.common.Player.EVENT_TIMELINE_CHANGED;
|
|
||||||
import static androidx.media3.common.Player.MEDIA_ITEM_TRANSITION_REASON_SEEK;
|
|
||||||
import static androidx.media3.common.Player.PLAYBACK_SUPPRESSION_REASON_NONE;
|
|
||||||
import static androidx.media3.common.Player.PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST;
|
|
||||||
import static androidx.media3.common.Player.STATE_IDLE;
|
|
||||||
import static androidx.media3.common.Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED;
|
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||||
import static androidx.media3.common.util.Assertions.checkState;
|
import static androidx.media3.common.util.Assertions.checkState;
|
||||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||||
import static androidx.media3.session.MediaConstants.ARGUMENT_CAPTIONING_ENABLED;
|
|
||||||
import static androidx.media3.session.MediaConstants.SESSION_COMMAND_ON_CAPTIONING_ENABLED_CHANGED;
|
|
||||||
import static androidx.media3.session.MediaUtils.POSITION_DIFF_TOLERANCE_MS;
|
|
||||||
import static androidx.media3.session.MediaUtils.calculateBufferedPercentage;
|
import static androidx.media3.session.MediaUtils.calculateBufferedPercentage;
|
||||||
import static androidx.media3.session.SessionResult.RESULT_SUCCESS;
|
|
||||||
import static java.lang.Math.max;
|
import static java.lang.Math.max;
|
||||||
import static java.lang.Math.min;
|
import static java.lang.Math.min;
|
||||||
|
|
||||||
@ -73,13 +54,9 @@ import androidx.media3.common.PlaybackException;
|
|||||||
import androidx.media3.common.PlaybackParameters;
|
import androidx.media3.common.PlaybackParameters;
|
||||||
import androidx.media3.common.Player;
|
import androidx.media3.common.Player;
|
||||||
import androidx.media3.common.Player.Commands;
|
import androidx.media3.common.Player.Commands;
|
||||||
import androidx.media3.common.Player.DiscontinuityReason;
|
|
||||||
import androidx.media3.common.Player.Events;
|
import androidx.media3.common.Player.Events;
|
||||||
import androidx.media3.common.Player.Listener;
|
import androidx.media3.common.Player.Listener;
|
||||||
import androidx.media3.common.Player.MediaItemTransitionReason;
|
|
||||||
import androidx.media3.common.Player.PositionInfo;
|
import androidx.media3.common.Player.PositionInfo;
|
||||||
import androidx.media3.common.Player.RepeatMode;
|
|
||||||
import androidx.media3.common.Player.State;
|
|
||||||
import androidx.media3.common.Rating;
|
import androidx.media3.common.Rating;
|
||||||
import androidx.media3.common.Timeline;
|
import androidx.media3.common.Timeline;
|
||||||
import androidx.media3.common.Timeline.Window;
|
import androidx.media3.common.Timeline.Window;
|
||||||
@ -171,7 +148,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (controllerInfo.playerInfo.playbackState == STATE_IDLE) {
|
if (controllerInfo.playerInfo.playbackState == Player.STATE_IDLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerInfo maskedPlayerInfo =
|
PlayerInfo maskedPlayerInfo =
|
||||||
@ -189,10 +166,10 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
controllerInfo.playerInfo.sessionPositionInfo.positionInfo.positionMs,
|
controllerInfo.playerInfo.sessionPositionInfo.positionInfo.positionMs,
|
||||||
controllerInfo.playerInfo.sessionPositionInfo.durationMs),
|
controllerInfo.playerInfo.sessionPositionInfo.durationMs),
|
||||||
/* totalBufferedDurationMs= */ 0));
|
/* totalBufferedDurationMs= */ 0));
|
||||||
if (controllerInfo.playerInfo.playbackState != STATE_IDLE) {
|
if (controllerInfo.playerInfo.playbackState != Player.STATE_IDLE) {
|
||||||
maskedPlayerInfo =
|
maskedPlayerInfo =
|
||||||
maskedPlayerInfo.copyWithPlaybackState(
|
maskedPlayerInfo.copyWithPlaybackState(
|
||||||
STATE_IDLE, /* playerError= */ controllerInfo.playerInfo.playerError);
|
Player.STATE_IDLE, /* playerError= */ controllerInfo.playerInfo.playerError);
|
||||||
}
|
}
|
||||||
ControllerInfo maskedControllerInfo =
|
ControllerInfo maskedControllerInfo =
|
||||||
new ControllerInfo(
|
new ControllerInfo(
|
||||||
@ -248,8 +225,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
new ControllerInfo(
|
new ControllerInfo(
|
||||||
controllerInfo.playerInfo.copyWithPlayWhenReady(
|
controllerInfo.playerInfo.copyWithPlayWhenReady(
|
||||||
/* playWhenReady= */ true,
|
/* playWhenReady= */ true,
|
||||||
PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
|
Player.PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
|
||||||
PLAYBACK_SUPPRESSION_REASON_NONE),
|
Player.PLAYBACK_SUPPRESSION_REASON_NONE),
|
||||||
controllerInfo.availableSessionCommands,
|
controllerInfo.availableSessionCommands,
|
||||||
controllerInfo.availablePlayerCommands,
|
controllerInfo.availablePlayerCommands,
|
||||||
controllerInfo.customLayout);
|
controllerInfo.customLayout);
|
||||||
@ -272,8 +249,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
new ControllerInfo(
|
new ControllerInfo(
|
||||||
controllerInfo.playerInfo.copyWithPlayWhenReady(
|
controllerInfo.playerInfo.copyWithPlayWhenReady(
|
||||||
/* playWhenReady= */ false,
|
/* playWhenReady= */ false,
|
||||||
PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
|
Player.PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
|
||||||
PLAYBACK_SUPPRESSION_REASON_NONE),
|
Player.PLAYBACK_SUPPRESSION_REASON_NONE),
|
||||||
controllerInfo.availableSessionCommands,
|
controllerInfo.availableSessionCommands,
|
||||||
controllerInfo.availablePlayerCommands,
|
controllerInfo.availablePlayerCommands,
|
||||||
controllerInfo.customLayout);
|
controllerInfo.customLayout);
|
||||||
@ -289,7 +266,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void prepare() {
|
public void prepare() {
|
||||||
if (controllerInfo.playerInfo.playbackState != STATE_IDLE) {
|
if (controllerInfo.playerInfo.playbackState != Player.STATE_IDLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ControllerInfo maskedControllerInfo =
|
ControllerInfo maskedControllerInfo =
|
||||||
@ -344,7 +321,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
int newMediaItemIndex = currentMediaItemIndex;
|
int newMediaItemIndex = currentMediaItemIndex;
|
||||||
@Nullable
|
@Nullable
|
||||||
@MediaItemTransitionReason
|
@Player.MediaItemTransitionReason
|
||||||
Integer mediaItemTransitionReason = null;
|
Integer mediaItemTransitionReason = null;
|
||||||
if (mediaItemIndex != currentMediaItemIndex) {
|
if (mediaItemIndex != currentMediaItemIndex) {
|
||||||
QueueTimeline queueTimeline = (QueueTimeline) controllerInfo.playerInfo.timeline;
|
QueueTimeline queueTimeline = (QueueTimeline) controllerInfo.playerInfo.timeline;
|
||||||
@ -352,7 +329,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
if (queueId != QueueItem.UNKNOWN_ID) {
|
if (queueId != QueueItem.UNKNOWN_ID) {
|
||||||
controllerCompat.getTransportControls().skipToQueueItem(queueId);
|
controllerCompat.getTransportControls().skipToQueueItem(queueId);
|
||||||
newMediaItemIndex = mediaItemIndex;
|
newMediaItemIndex = mediaItemIndex;
|
||||||
mediaItemTransitionReason = MEDIA_ITEM_TRANSITION_REASON_SEEK;
|
mediaItemTransitionReason = Player.MEDIA_ITEM_TRANSITION_REASON_SEEK;
|
||||||
} else {
|
} else {
|
||||||
Log.w(
|
Log.w(
|
||||||
TAG,
|
TAG,
|
||||||
@ -362,7 +339,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Nullable
|
@Nullable
|
||||||
@DiscontinuityReason
|
@Player.DiscontinuityReason
|
||||||
Integer discontinuityReason;
|
Integer discontinuityReason;
|
||||||
long currentPositionMs = getCurrentPosition();
|
long currentPositionMs = getCurrentPosition();
|
||||||
long newPositionMs;
|
long newPositionMs;
|
||||||
@ -372,7 +349,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
} else {
|
} else {
|
||||||
controllerCompat.getTransportControls().seekTo(positionMs);
|
controllerCompat.getTransportControls().seekTo(positionMs);
|
||||||
newPositionMs = positionMs;
|
newPositionMs = positionMs;
|
||||||
discontinuityReason = DISCONTINUITY_REASON_SEEK;
|
discontinuityReason = Player.DISCONTINUITY_REASON_SEEK;
|
||||||
}
|
}
|
||||||
|
|
||||||
long newDurationMs;
|
long newDurationMs;
|
||||||
@ -540,17 +517,17 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
public ListenableFuture<SessionResult> setRating(String mediaId, Rating rating) {
|
public ListenableFuture<SessionResult> setRating(String mediaId, Rating rating) {
|
||||||
@Nullable
|
@Nullable
|
||||||
String currentMediaItemMediaId =
|
String currentMediaItemMediaId =
|
||||||
legacyPlayerInfo.mediaMetadataCompat.getString(METADATA_KEY_MEDIA_ID);
|
legacyPlayerInfo.mediaMetadataCompat.getString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID);
|
||||||
if (mediaId.equals(currentMediaItemMediaId)) {
|
if (mediaId.equals(currentMediaItemMediaId)) {
|
||||||
controllerCompat.getTransportControls().setRating(MediaUtils.convertToRatingCompat(rating));
|
controllerCompat.getTransportControls().setRating(MediaUtils.convertToRatingCompat(rating));
|
||||||
}
|
}
|
||||||
return Futures.immediateFuture(new SessionResult(RESULT_SUCCESS));
|
return Futures.immediateFuture(new SessionResult(SessionResult.RESULT_SUCCESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<SessionResult> setRating(Rating rating) {
|
public ListenableFuture<SessionResult> setRating(Rating rating) {
|
||||||
controllerCompat.getTransportControls().setRating(MediaUtils.convertToRatingCompat(rating));
|
controllerCompat.getTransportControls().setRating(MediaUtils.convertToRatingCompat(rating));
|
||||||
return Futures.immediateFuture(new SessionResult(RESULT_SUCCESS));
|
return Futures.immediateFuture(new SessionResult(SessionResult.RESULT_SUCCESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -595,7 +572,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
public ListenableFuture<SessionResult> sendCustomCommand(SessionCommand command, Bundle args) {
|
public ListenableFuture<SessionResult> sendCustomCommand(SessionCommand command, Bundle args) {
|
||||||
if (controllerInfo.availableSessionCommands.contains(command)) {
|
if (controllerInfo.availableSessionCommands.contains(command)) {
|
||||||
controllerCompat.getTransportControls().sendCustomAction(command.customAction, args);
|
controllerCompat.getTransportControls().sendCustomAction(command.customAction, args);
|
||||||
return Futures.immediateFuture(new SessionResult(RESULT_SUCCESS));
|
return Futures.immediateFuture(new SessionResult(SessionResult.RESULT_SUCCESS));
|
||||||
}
|
}
|
||||||
SettableFuture<SessionResult> result = SettableFuture.create();
|
SettableFuture<SessionResult> result = SettableFuture.create();
|
||||||
ResultReceiver cb =
|
ResultReceiver cb =
|
||||||
@ -926,14 +903,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@RepeatMode
|
@Player.RepeatMode
|
||||||
public int getRepeatMode() {
|
public int getRepeatMode() {
|
||||||
return controllerInfo.playerInfo.repeatMode;
|
return controllerInfo.playerInfo.repeatMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRepeatMode(@RepeatMode int repeatMode) {
|
public void setRepeatMode(@Player.RepeatMode int repeatMode) {
|
||||||
@RepeatMode int currentRepeatMode = getRepeatMode();
|
@Player.RepeatMode int currentRepeatMode = getRepeatMode();
|
||||||
if (repeatMode != currentRepeatMode) {
|
if (repeatMode != currentRepeatMode) {
|
||||||
ControllerInfo maskedControllerInfo =
|
ControllerInfo maskedControllerInfo =
|
||||||
new ControllerInfo(
|
new ControllerInfo(
|
||||||
@ -1168,11 +1145,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
@Player.PlaybackSuppressionReason
|
@Player.PlaybackSuppressionReason
|
||||||
public int getPlaybackSuppressionReason() {
|
public int getPlaybackSuppressionReason() {
|
||||||
// Not supported.
|
// Not supported.
|
||||||
return PLAYBACK_SUPPRESSION_REASON_NONE;
|
return Player.PLAYBACK_SUPPRESSION_REASON_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@State
|
@Player.State
|
||||||
public int getPlaybackState() {
|
public int getPlaybackState() {
|
||||||
return controllerInfo.playerInfo.playbackState;
|
return controllerInfo.playerInfo.playbackState;
|
||||||
}
|
}
|
||||||
@ -1286,7 +1263,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPrepared() {
|
private boolean isPrepared() {
|
||||||
return controllerInfo.playerInfo.playbackState != STATE_IDLE;
|
return controllerInfo.playerInfo.playbackState != Player.STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasMedia() {
|
private boolean hasMedia() {
|
||||||
@ -1444,10 +1421,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
if (!oldControllerInfo.playerInfo.timeline.equals(newControllerInfo.playerInfo.timeline)) {
|
if (!oldControllerInfo.playerInfo.timeline.equals(newControllerInfo.playerInfo.timeline)) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_TIMELINE_CHANGED,
|
Player.EVENT_TIMELINE_CHANGED,
|
||||||
(listener) ->
|
(listener) ->
|
||||||
listener.onTimelineChanged(
|
listener.onTimelineChanged(
|
||||||
newControllerInfo.playerInfo.timeline, TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED));
|
newControllerInfo.playerInfo.timeline,
|
||||||
|
Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED));
|
||||||
}
|
}
|
||||||
if (!Util.areEqual(oldLegacyPlayerInfo.queueTitle, newLegacyPlayerInfo.queueTitle)) {
|
if (!Util.areEqual(oldLegacyPlayerInfo.queueTitle, newLegacyPlayerInfo.queueTitle)) {
|
||||||
// TODO(b/187152483): Set proper event code when available.
|
// TODO(b/187152483): Set proper event code when available.
|
||||||
@ -1467,7 +1445,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
if (mediaItemTransitionReason != null) {
|
if (mediaItemTransitionReason != null) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_MEDIA_ITEM_TRANSITION,
|
Player.EVENT_MEDIA_ITEM_TRANSITION,
|
||||||
(listener) ->
|
(listener) ->
|
||||||
listener.onMediaItemTransition(
|
listener.onMediaItemTransition(
|
||||||
newControllerInfo.playerInfo.getCurrentMediaItem(), mediaItemTransitionReason));
|
newControllerInfo.playerInfo.getCurrentMediaItem(), mediaItemTransitionReason));
|
||||||
@ -1476,25 +1454,27 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
oldLegacyPlayerInfo.playbackStateCompat, newLegacyPlayerInfo.playbackStateCompat)) {
|
oldLegacyPlayerInfo.playbackStateCompat, newLegacyPlayerInfo.playbackStateCompat)) {
|
||||||
PlaybackException error =
|
PlaybackException error =
|
||||||
MediaUtils.convertToPlaybackException(newLegacyPlayerInfo.playbackStateCompat);
|
MediaUtils.convertToPlaybackException(newLegacyPlayerInfo.playbackStateCompat);
|
||||||
listeners.queueEvent(EVENT_PLAYER_ERROR, (listener) -> listener.onPlayerErrorChanged(error));
|
listeners.queueEvent(
|
||||||
|
Player.EVENT_PLAYER_ERROR, (listener) -> listener.onPlayerErrorChanged(error));
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
listeners.queueEvent(EVENT_PLAYER_ERROR, (listener) -> listener.onPlayerError(error));
|
listeners.queueEvent(
|
||||||
|
Player.EVENT_PLAYER_ERROR, (listener) -> listener.onPlayerError(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldLegacyPlayerInfo.mediaMetadataCompat != newLegacyPlayerInfo.mediaMetadataCompat) {
|
if (oldLegacyPlayerInfo.mediaMetadataCompat != newLegacyPlayerInfo.mediaMetadataCompat) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_MEDIA_METADATA_CHANGED,
|
Player.EVENT_MEDIA_METADATA_CHANGED,
|
||||||
(listener) -> listener.onMediaMetadataChanged(controllerInfo.playerInfo.mediaMetadata));
|
(listener) -> listener.onMediaMetadataChanged(controllerInfo.playerInfo.mediaMetadata));
|
||||||
}
|
}
|
||||||
if (oldControllerInfo.playerInfo.playbackState != newControllerInfo.playerInfo.playbackState) {
|
if (oldControllerInfo.playerInfo.playbackState != newControllerInfo.playerInfo.playbackState) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_PLAYBACK_STATE_CHANGED,
|
Player.EVENT_PLAYBACK_STATE_CHANGED,
|
||||||
(listener) ->
|
(listener) ->
|
||||||
listener.onPlaybackStateChanged(newControllerInfo.playerInfo.playbackState));
|
listener.onPlaybackStateChanged(newControllerInfo.playerInfo.playbackState));
|
||||||
}
|
}
|
||||||
if (oldControllerInfo.playerInfo.playWhenReady != newControllerInfo.playerInfo.playWhenReady) {
|
if (oldControllerInfo.playerInfo.playWhenReady != newControllerInfo.playerInfo.playWhenReady) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_PLAY_WHEN_READY_CHANGED,
|
Player.EVENT_PLAY_WHEN_READY_CHANGED,
|
||||||
(listener) ->
|
(listener) ->
|
||||||
listener.onPlayWhenReadyChanged(
|
listener.onPlayWhenReadyChanged(
|
||||||
newControllerInfo.playerInfo.playWhenReady,
|
newControllerInfo.playerInfo.playWhenReady,
|
||||||
@ -1502,13 +1482,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
if (oldControllerInfo.playerInfo.isPlaying != newControllerInfo.playerInfo.isPlaying) {
|
if (oldControllerInfo.playerInfo.isPlaying != newControllerInfo.playerInfo.isPlaying) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_IS_PLAYING_CHANGED,
|
Player.EVENT_IS_PLAYING_CHANGED,
|
||||||
(listener) -> listener.onIsPlayingChanged(newControllerInfo.playerInfo.isPlaying));
|
(listener) -> listener.onIsPlayingChanged(newControllerInfo.playerInfo.isPlaying));
|
||||||
}
|
}
|
||||||
if (!oldControllerInfo.playerInfo.playbackParameters.equals(
|
if (!oldControllerInfo.playerInfo.playbackParameters.equals(
|
||||||
newControllerInfo.playerInfo.playbackParameters)) {
|
newControllerInfo.playerInfo.playbackParameters)) {
|
||||||
listeners.queueEvent(
|
listeners.queueEvent(
|
||||||
EVENT_PLAYBACK_PARAMETERS_CHANGED,
|
Player.EVENT_PLAYBACK_PARAMETERS_CHANGED,
|
||||||
(listener) ->
|
(listener) ->
|
||||||
listener.onPlaybackParametersChanged(
|
listener.onPlaybackParametersChanged(
|
||||||
newControllerInfo.playerInfo.playbackParameters));
|
newControllerInfo.playerInfo.playbackParameters));
|
||||||
@ -1705,12 +1685,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
.notifyControllerListener(
|
.notifyControllerListener(
|
||||||
listener -> {
|
listener -> {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putBoolean(ARGUMENT_CAPTIONING_ENABLED, enabled);
|
args.putBoolean(MediaConstants.ARGUMENT_CAPTIONING_ENABLED, enabled);
|
||||||
ignoreFuture(
|
ignoreFuture(
|
||||||
listener.onCustomCommand(
|
listener.onCustomCommand(
|
||||||
getInstance(),
|
getInstance(),
|
||||||
new SessionCommand(
|
new SessionCommand(
|
||||||
SESSION_COMMAND_ON_CAPTIONING_ENABLED_CHANGED,
|
MediaConstants.SESSION_COMMAND_ON_CAPTIONING_ENABLED_CHANGED,
|
||||||
/* extras= */ Bundle.EMPTY),
|
/* extras= */ Bundle.EMPTY),
|
||||||
args));
|
args));
|
||||||
});
|
});
|
||||||
@ -1754,7 +1734,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
MediaMetadata mediaMetadata;
|
MediaMetadata mediaMetadata;
|
||||||
int currentMediaItemIndex;
|
int currentMediaItemIndex;
|
||||||
MediaMetadata playlistMetadata;
|
MediaMetadata playlistMetadata;
|
||||||
@RepeatMode int repeatMode;
|
@Player.RepeatMode int repeatMode;
|
||||||
boolean shuffleModeEnabled;
|
boolean shuffleModeEnabled;
|
||||||
SessionCommands availableSessionCommands;
|
SessionCommands availableSessionCommands;
|
||||||
Commands availablePlayerCommands;
|
Commands availablePlayerCommands;
|
||||||
@ -1883,7 +1863,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
MediaUtils.convertToAudioAttributes(newLegacyPlayerInfo.playbackInfoCompat);
|
MediaUtils.convertToAudioAttributes(newLegacyPlayerInfo.playbackInfoCompat);
|
||||||
boolean playWhenReady =
|
boolean playWhenReady =
|
||||||
MediaUtils.convertToPlayWhenReady(newLegacyPlayerInfo.playbackStateCompat);
|
MediaUtils.convertToPlayWhenReady(newLegacyPlayerInfo.playbackStateCompat);
|
||||||
@State
|
@Player.State
|
||||||
int playbackState =
|
int playbackState =
|
||||||
MediaUtils.convertToPlaybackState(
|
MediaUtils.convertToPlaybackState(
|
||||||
newLegacyPlayerInfo.playbackStateCompat,
|
newLegacyPlayerInfo.playbackStateCompat,
|
||||||
@ -1982,7 +1962,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
// If the position is reset, then it's probably repeating the same media item.
|
// If the position is reset, then it's probably repeating the same media item.
|
||||||
discontinuityReason = Player.DISCONTINUITY_REASON_AUTO_TRANSITION;
|
discontinuityReason = Player.DISCONTINUITY_REASON_AUTO_TRANSITION;
|
||||||
mediaItemTransitionReason = Player.MEDIA_ITEM_TRANSITION_REASON_REPEAT;
|
mediaItemTransitionReason = Player.MEDIA_ITEM_TRANSITION_REASON_REPEAT;
|
||||||
} else if (Math.abs(oldCurrentPosition - newCurrentPosition) > POSITION_DIFF_TOLERANCE_MS) {
|
} else if (Math.abs(oldCurrentPosition - newCurrentPosition)
|
||||||
|
> MediaUtils.POSITION_DIFF_TOLERANCE_MS) {
|
||||||
// Unexpected position discontinuity within the same media item.
|
// Unexpected position discontinuity within the same media item.
|
||||||
discontinuityReason = Player.DISCONTINUITY_REASON_INTERNAL;
|
discontinuityReason = Player.DISCONTINUITY_REASON_INTERNAL;
|
||||||
mediaItemTransitionReason = null;
|
mediaItemTransitionReason = null;
|
||||||
@ -2069,7 +2050,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
MediaMetadata mediaMetadata,
|
MediaMetadata mediaMetadata,
|
||||||
int currentMediaItemIndex,
|
int currentMediaItemIndex,
|
||||||
MediaMetadata playlistMetadata,
|
MediaMetadata playlistMetadata,
|
||||||
@RepeatMode int repeatMode,
|
@Player.RepeatMode int repeatMode,
|
||||||
boolean shuffleModeEnabled,
|
boolean shuffleModeEnabled,
|
||||||
SessionCommands availableSessionCommands,
|
SessionCommands availableSessionCommands,
|
||||||
Commands availablePlayerCommands,
|
Commands availablePlayerCommands,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user