Update most Player parameter & doc references from Window to MediaItem

Only deprecated references remain.

Usages of the deprecated methods will be migrated in a follow-up change.

#minor-release

PiperOrigin-RevId: 405927141
This commit is contained in:
ibaker 2021-10-27 18:51:03 +01:00 committed by Ian Baker
parent b60acca872
commit d83fe03d88
10 changed files with 98 additions and 100 deletions

View File

@ -326,10 +326,9 @@ public final class CastPlayer extends BasePlayer {
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) {
setMediaItemsInternal( setMediaItemsInternal(
toMediaQueueItems(mediaItems), startWindowIndex, startPositionMs, repeatMode.value); toMediaQueueItems(mediaItems), startIndex, startPositionMs, repeatMode.value);
} }
@Override @Override
@ -440,23 +439,23 @@ public final class CastPlayer extends BasePlayer {
// don't implement onPositionDiscontinuity(). // don't implement onPositionDiscontinuity().
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
MediaStatus mediaStatus = getMediaStatus(); MediaStatus mediaStatus = getMediaStatus();
// We assume the default position is 0. There is no support for seeking to the default position // We assume the default position is 0. There is no support for seeking to the default position
// in RemoteMediaClient. // in RemoteMediaClient.
positionMs = positionMs != C.TIME_UNSET ? positionMs : 0; positionMs = positionMs != C.TIME_UNSET ? positionMs : 0;
if (mediaStatus != null) { if (mediaStatus != null) {
if (getCurrentWindowIndex() != windowIndex) { if (getCurrentWindowIndex() != mediaItemIndex) {
remoteMediaClient remoteMediaClient
.queueJumpToItem( .queueJumpToItem(
(int) currentTimeline.getPeriod(windowIndex, period).uid, positionMs, null) (int) currentTimeline.getPeriod(mediaItemIndex, period).uid, positionMs, null)
.setResultCallback(seekResultCallback); .setResultCallback(seekResultCallback);
} else { } else {
remoteMediaClient.seek(positionMs).setResultCallback(seekResultCallback); remoteMediaClient.seek(positionMs).setResultCallback(seekResultCallback);
} }
PositionInfo oldPosition = getCurrentPositionInfo(); PositionInfo oldPosition = getCurrentPositionInfo();
pendingSeekCount++; pendingSeekCount++;
pendingSeekWindowIndex = windowIndex; pendingSeekWindowIndex = mediaItemIndex;
pendingSeekPositionMs = positionMs; pendingSeekPositionMs = positionMs;
PositionInfo newPosition = getCurrentPositionInfo(); PositionInfo newPosition = getCurrentPositionInfo();
listeners.queueEvent( listeners.queueEvent(
@ -468,7 +467,7 @@ public final class CastPlayer extends BasePlayer {
if (oldPosition.mediaItemIndex != newPosition.mediaItemIndex) { if (oldPosition.mediaItemIndex != newPosition.mediaItemIndex) {
// TODO(internal b/182261884): queue `onMediaItemTransition` event when the media item is // TODO(internal b/182261884): queue `onMediaItemTransition` event when the media item is
// repeated. // repeated.
MediaItem mediaItem = getCurrentTimeline().getWindow(windowIndex, window).mediaItem; MediaItem mediaItem = getCurrentTimeline().getWindow(mediaItemIndex, window).mediaItem;
listeners.queueEvent( listeners.queueEvent(
Player.EVENT_MEDIA_ITEM_TRANSITION, Player.EVENT_MEDIA_ITEM_TRANSITION,
listener -> listener ->

View File

@ -124,8 +124,8 @@ public abstract class BasePlayer implements Player {
} }
@Override @Override
public final void seekToDefaultPosition(int windowIndex) { public final void seekToDefaultPosition(int mediaItemIndex) {
seekTo(windowIndex, /* positionMs= */ C.TIME_UNSET); seekTo(mediaItemIndex, /* positionMs= */ C.TIME_UNSET);
} }
@Override @Override

View File

@ -65,9 +65,8 @@ public class ForwardingPlayer implements Player {
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) { player.setMediaItems(mediaItems, startIndex, startPositionMs);
player.setMediaItems(mediaItems, startWindowIndex, startPositionMs);
} }
@Override @Override
@ -222,8 +221,8 @@ public class ForwardingPlayer implements Player {
} }
@Override @Override
public void seekToDefaultPosition(int windowIndex) { public void seekToDefaultPosition(int mediaItemIndex) {
player.seekToDefaultPosition(windowIndex); player.seekToDefaultPosition(mediaItemIndex);
} }
@Override @Override
@ -232,8 +231,8 @@ public class ForwardingPlayer implements Player {
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
player.seekTo(windowIndex, positionMs); player.seekTo(mediaItemIndex, positionMs);
} }
@Override @Override

View File

@ -1512,16 +1512,16 @@ public interface Player {
* Clears the playlist and adds the specified {@link MediaItem MediaItems}. * Clears the playlist and adds the specified {@link MediaItem MediaItems}.
* *
* @param mediaItems The new {@link MediaItem MediaItems}. * @param mediaItems The new {@link MediaItem MediaItems}.
* @param startWindowIndex The window index to start playback from. If {@link C#INDEX_UNSET} is * @param startIndex The {@link MediaItem} index to start playback from. If {@link C#INDEX_UNSET}
* passed, the current position is not reset. * is passed, the current position is not reset.
* @param startPositionMs The position in milliseconds to start playback from. If {@link * @param startPositionMs The position in milliseconds to start playback from. If {@link
* C#TIME_UNSET} is passed, the default position of the given window is used. In any case, if * C#TIME_UNSET} is passed, the default position of the given {@link MediaItem} is used. In
* {@code startWindowIndex} is set to {@link C#INDEX_UNSET}, this parameter is ignored and the * any case, if {@code startIndex} is set to {@link C#INDEX_UNSET}, this parameter is ignored
* position is not reset at all. * and the position is not reset at all.
* @throws IllegalSeekPositionException If the provided {@code startWindowIndex} is not within the * @throws IllegalSeekPositionException If the provided {@code startIndex} is not within the
* bounds of the list of media items. * bounds of the list of media items.
*/ */
void setMediaItems(List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs); void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs);
/** /**
* Clears the playlist, adds the specified {@link MediaItem} and resets the position to the * Clears the playlist, adds the specified {@link MediaItem} and resets the position to the
@ -1648,9 +1648,9 @@ public interface Player {
* Listener#onAvailableCommandsChanged(Commands)} to get an update when the available commands * Listener#onAvailableCommandsChanged(Commands)} to get an update when the available commands
* change. * change.
* *
* <p>Executing a command that is not available (for example, calling {@link #seekToNextWindow()} * <p>Executing a command that is not available (for example, calling {@link
* if {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} is unavailable) will neither throw an exception nor * #seekToNextMediaItem()} if {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} is unavailable) will
* generate a {@link #getPlayerError()} player error}. * neither throw an exception nor generate a {@link #getPlayerError()} player error}.
* *
* <p>{@link #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM} and {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} * <p>{@link #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM} and {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM}
* are unavailable if there is no such {@link MediaItem}. * are unavailable if there is no such {@link MediaItem}.
@ -1755,14 +1755,14 @@ public interface Player {
int getRepeatMode(); int getRepeatMode();
/** /**
* Sets whether shuffling of windows is enabled. * Sets whether shuffling of media items is enabled.
* *
* @param shuffleModeEnabled Whether shuffling is enabled. * @param shuffleModeEnabled Whether shuffling is enabled.
*/ */
void setShuffleModeEnabled(boolean shuffleModeEnabled); void setShuffleModeEnabled(boolean shuffleModeEnabled);
/** /**
* Returns whether shuffling of windows is enabled. * Returns whether shuffling of media items is enabled.
* *
* @see Listener#onShuffleModeEnabledChanged(boolean) * @see Listener#onShuffleModeEnabledChanged(boolean)
*/ */
@ -1777,42 +1777,42 @@ public interface Player {
boolean isLoading(); boolean isLoading();
/** /**
* Seeks to the default position associated with the current window. The position can depend on * Seeks to the default position associated with the current {@link MediaItem}. The position can
* the type of media being played. For live streams it will typically be the live edge of the * depend on the type of media being played. For live streams it will typically be the live edge.
* window. For other streams it will typically be the start of the window. * For other streams it will typically be the start.
*/ */
void seekToDefaultPosition(); void seekToDefaultPosition();
/** /**
* Seeks to the default position associated with the specified window. The position can depend on * Seeks to the default position associated with the specified {@link MediaItem}. The position can
* the type of media being played. For live streams it will typically be the live edge of the * depend on the type of media being played. For live streams it will typically be the live edge.
* window. For other streams it will typically be the start of the window. * For other streams it will typically be the start.
* *
* @param windowIndex The index of the window whose associated default position should be seeked * @param mediaItemIndex The index of the {@link MediaItem} whose associated default position
* to. * should be seeked to.
* @throws IllegalSeekPositionException If the player has a non-empty timeline and the provided * @throws IllegalSeekPositionException If the player has a non-empty timeline and the provided
* {@code windowIndex} is not within the bounds of the current timeline. * {@code mediaItemIndex} is not within the bounds of the current timeline.
*/ */
void seekToDefaultPosition(int windowIndex); void seekToDefaultPosition(int mediaItemIndex);
/** /**
* Seeks to a position specified in milliseconds in the current window. * Seeks to a position specified in milliseconds in the current {@link MediaItem}.
* *
* @param positionMs The seek position in the current window, or {@link C#TIME_UNSET} to seek to * @param positionMs The seek position in the current {@link MediaItem}, or {@link C#TIME_UNSET}
* the window's default position. * to seek to the media item's default position.
*/ */
void seekTo(long positionMs); void seekTo(long positionMs);
/** /**
* Seeks to a position specified in milliseconds in the specified window. * Seeks to a position specified in milliseconds in the specified {@link MediaItem}.
* *
* @param windowIndex The index of the window. * @param mediaItemIndex The index of the {@link MediaItem}.
* @param positionMs The seek position in the specified window, or {@link C#TIME_UNSET} to seek to * @param positionMs The seek position in the specified {@link MediaItem}, or {@link C#TIME_UNSET}
* the window's default position. * to seek to the media item's default position.
* @throws IllegalSeekPositionException If the player has a non-empty timeline and the provided * @throws IllegalSeekPositionException If the player has a non-empty timeline and the provided
* {@code windowIndex} is not within the bounds of the current timeline. * {@code mediaItemIndex} is not within the bounds of the current timeline.
*/ */
void seekTo(int windowIndex, long positionMs); void seekTo(int mediaItemIndex, long positionMs);
/** /**
* Returns the {@link #seekBack()} increment. * Returns the {@link #seekBack()} increment.
@ -1822,7 +1822,9 @@ public interface Player {
*/ */
long getSeekBackIncrement(); long getSeekBackIncrement();
/** Seeks back in the current window by {@link #getSeekBackIncrement()} milliseconds. */ /**
* Seeks back in the current {@link MediaItem} by {@link #getSeekBackIncrement()} milliseconds.
*/
void seekBack(); void seekBack();
/** /**
@ -1833,7 +1835,10 @@ public interface Player {
*/ */
long getSeekForwardIncrement(); long getSeekForwardIncrement();
/** Seeks forward in the current window by {@link #getSeekForwardIncrement()} milliseconds. */ /**
* Seeks forward in the current {@link MediaItem} by {@link #getSeekForwardIncrement()}
* milliseconds.
*/
void seekForward(); void seekForward();
/** @deprecated Use {@link #hasPreviousMediaItem()} instead. */ /** @deprecated Use {@link #hasPreviousMediaItem()} instead. */
@ -1919,8 +1924,8 @@ public interface Player {
boolean hasNextWindow(); boolean hasNextWindow();
/** /**
* Returns whether a next window exists, which may depend on the current repeat mode and whether * Returns whether a next {@link MediaItem} exists, which may depend on the current repeat mode
* shuffle mode is enabled. * and whether shuffle mode is enabled.
* *
* <p>Note: When the repeat mode is {@link #REPEAT_MODE_ONE}, this method behaves the same as when * <p>Note: When the repeat mode is {@link #REPEAT_MODE_ONE}, this method behaves the same as when
* the current repeat mode is {@link #REPEAT_MODE_OFF}. See {@link #REPEAT_MODE_ONE} for more * the current repeat mode is {@link #REPEAT_MODE_OFF}. See {@link #REPEAT_MODE_ONE} for more
@ -1939,9 +1944,9 @@ public interface Player {
void seekToNextWindow(); void seekToNextWindow();
/** /**
* Seeks to the default position of the next window, which may depend on the current repeat mode * Seeks to the default position of the next {@link MediaItem}, which may depend on the current
* and whether shuffle mode is enabled. Does nothing if {@link #hasNextMediaItem()} is {@code * repeat mode and whether shuffle mode is enabled. Does nothing if {@link #hasNextMediaItem()} is
* false}. * {@code false}.
* *
* <p>Note: When the repeat mode is {@link #REPEAT_MODE_ONE}, this method behaves the same as when * <p>Note: When the repeat mode is {@link #REPEAT_MODE_ONE}, this method behaves the same as when
* the current repeat mode is {@link #REPEAT_MODE_OFF}. See {@link #REPEAT_MODE_ONE} for more * the current repeat mode is {@link #REPEAT_MODE_OFF}. See {@link #REPEAT_MODE_ONE} for more
@ -1957,8 +1962,8 @@ public interface Player {
* <li>If the timeline is empty or seeking is not possible, does nothing. * <li>If the timeline is empty or seeking is not possible, does nothing.
* <li>Otherwise, if {@link #hasNextMediaItem() a next media item exists}, seeks to the default * <li>Otherwise, if {@link #hasNextMediaItem() a next media item exists}, seeks to the default
* position of the next {@link MediaItem}. * position of the next {@link MediaItem}.
* <li>Otherwise, if the current window is {@link #isCurrentMediaItemLive() live} and has not * <li>Otherwise, if the current {@link MediaItem} is {@link #isCurrentMediaItemLive() live} and
* ended, seeks to the live edge of the current {@link MediaItem}. * has not ended, seeks to the live edge of the current {@link MediaItem}.
* <li>Otherwise, does nothing. * <li>Otherwise, does nothing.
* </ul> * </ul>
*/ */

View File

@ -421,9 +421,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) { setMediaSources(createMediaSources(mediaItems), startIndex, startPositionMs);
setMediaSources(createMediaSources(mediaItems), startWindowIndex, startPositionMs);
} }
public void setMediaSource(MediaSource mediaSource) { public void setMediaSource(MediaSource mediaSource) {
@ -655,10 +654,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
Timeline timeline = playbackInfo.timeline; Timeline timeline = playbackInfo.timeline;
if (windowIndex < 0 || (!timeline.isEmpty() && windowIndex >= timeline.getWindowCount())) { if (mediaItemIndex < 0
throw new IllegalSeekPositionException(timeline, windowIndex, positionMs); || (!timeline.isEmpty() && mediaItemIndex >= timeline.getWindowCount())) {
throw new IllegalSeekPositionException(timeline, mediaItemIndex, positionMs);
} }
pendingOperationAcks++; pendingOperationAcks++;
if (isPlayingAd()) { if (isPlayingAd()) {
@ -681,8 +681,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
maskTimelineAndPosition( maskTimelineAndPosition(
newPlaybackInfo, newPlaybackInfo,
timeline, timeline,
getPeriodPositionOrMaskWindowPosition(timeline, windowIndex, positionMs)); getPeriodPositionOrMaskWindowPosition(timeline, mediaItemIndex, positionMs));
internalPlayer.seekTo(timeline, windowIndex, C.msToUs(positionMs)); internalPlayer.seekTo(timeline, mediaItemIndex, C.msToUs(positionMs));
updatePlaybackInfo( updatePlaybackInfo(
newPlaybackInfo, newPlaybackInfo,
/* ignored */ TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, /* ignored */ TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED,

View File

@ -1097,10 +1097,9 @@ public class SimpleExoPlayer extends BasePlayer
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) {
verifyApplicationThread(); verifyApplicationThread();
player.setMediaItems(mediaItems, startWindowIndex, startPositionMs); player.setMediaItems(mediaItems, startIndex, startPositionMs);
} }
@Override @Override
@ -1246,10 +1245,10 @@ public class SimpleExoPlayer extends BasePlayer
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
verifyApplicationThread(); verifyApplicationThread();
analyticsCollector.notifySeekStarted(); analyticsCollector.notifySeekStarted();
player.seekTo(windowIndex, positionMs); player.seekTo(mediaItemIndex, positionMs);
} }
@Override @Override

View File

@ -520,13 +520,13 @@ public class MediaController implements Player {
} }
@Override @Override
public void seekToDefaultPosition(int windowIndex) { public void seekToDefaultPosition(int mediaItemIndex) {
verifyApplicationThread(); verifyApplicationThread();
if (!isConnected()) { if (!isConnected()) {
Log.w(TAG, "The controller is not connected. Ignoring seekTo()."); Log.w(TAG, "The controller is not connected. Ignoring seekTo().");
return; return;
} }
impl.seekToDefaultPosition(windowIndex); impl.seekToDefaultPosition(mediaItemIndex);
} }
@Override @Override
@ -540,13 +540,13 @@ public class MediaController implements Player {
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
verifyApplicationThread(); verifyApplicationThread();
if (!isConnected()) { if (!isConnected()) {
Log.w(TAG, "The controller is not connected. Ignoring seekTo()."); Log.w(TAG, "The controller is not connected. Ignoring seekTo().");
return; return;
} }
impl.seekTo(windowIndex, positionMs); impl.seekTo(mediaItemIndex, positionMs);
} }
/** /**
@ -946,8 +946,7 @@ public class MediaController implements Player {
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) {
verifyApplicationThread(); verifyApplicationThread();
checkNotNull(mediaItems, "mediaItems must not be null"); checkNotNull(mediaItems, "mediaItems must not be null");
for (int i = 0; i < mediaItems.size(); i++) { for (int i = 0; i < mediaItems.size(); i++) {
@ -957,7 +956,7 @@ public class MediaController implements Player {
Log.w(TAG, "The controller is not connected. Ignoring setMediaItems()."); Log.w(TAG, "The controller is not connected. Ignoring setMediaItems().");
return; return;
} }
impl.setMediaItems(mediaItems, startWindowIndex, startPositionMs); impl.setMediaItems(mediaItems, startIndex, startPositionMs);
} }
/** /**
@ -1287,7 +1286,7 @@ public class MediaController implements Player {
* *
* <p>Interoperability: When connected to {@link * <p>Interoperability: When connected to {@link
* android.support.v4.media.session.MediaSessionCompat}, this will always return {@link * android.support.v4.media.session.MediaSessionCompat}, this will always return {@link
* C#INDEX_UNSET} even when {@link #hasPreviousWindow()} is {@code true}. * C#INDEX_UNSET} even when {@link #hasPreviousMediaItem()} is {@code true}.
*/ */
@Override @Override
public int getPreviousMediaItemIndex() { public int getPreviousMediaItemIndex() {
@ -1308,7 +1307,7 @@ public class MediaController implements Player {
* *
* <p>Interoperability: When connected to {@link * <p>Interoperability: When connected to {@link
* android.support.v4.media.session.MediaSessionCompat}, this will always return {@link * android.support.v4.media.session.MediaSessionCompat}, this will always return {@link
* C#INDEX_UNSET} even when {@link #hasNextWindow()} is {@code true}. * C#INDEX_UNSET} even when {@link #hasNextMediaItem()} is {@code true}.
*/ */
@Override @Override
public int getNextMediaItemIndex() { public int getNextMediaItemIndex() {
@ -1424,8 +1423,8 @@ public class MediaController implements Player {
* {@inheritDoc} * {@inheritDoc}
* *
* <p>Interoperability: When connected to {@link * <p>Interoperability: When connected to {@link
* android.support.v4.media.session.MediaSessionCompat}, it wouldn't update current window index * android.support.v4.media.session.MediaSessionCompat}, it won't update the current media item
* immediately because previous window index is unknown. * index immediately because the previous media item index is unknown.
*/ */
@Override @Override
public void seekToPrevious() { public void seekToPrevious() {
@ -1453,8 +1452,8 @@ public class MediaController implements Player {
* {@inheritDoc} * {@inheritDoc}
* *
* <p>Interoperability: When connected to {@link * <p>Interoperability: When connected to {@link
* android.support.v4.media.session.MediaSessionCompat}, it wouldn't update current window index * android.support.v4.media.session.MediaSessionCompat}, it won't update the current media item
* immediately because previous window index is unknown. * index immediately because the previous media item index is unknown.
*/ */
@Override @Override
public void seekToNext() { public void seekToNext() {

View File

@ -106,9 +106,9 @@ import java.util.List;
} }
@Override @Override
public void seekToDefaultPosition(int windowIndex) { public void seekToDefaultPosition(int mediaItemIndex) {
verifyApplicationThread(); verifyApplicationThread();
super.seekToDefaultPosition(windowIndex); super.seekToDefaultPosition(mediaItemIndex);
} }
@Override @Override
@ -118,9 +118,9 @@ import java.util.List;
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
verifyApplicationThread(); verifyApplicationThread();
super.seekTo(windowIndex, positionMs); super.seekTo(mediaItemIndex, positionMs);
} }
@Override @Override
@ -334,10 +334,9 @@ import java.util.List;
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) {
verifyApplicationThread(); verifyApplicationThread();
super.setMediaItems(mediaItems, startWindowIndex, startPositionMs); super.setMediaItems(mediaItems, startIndex, startPositionMs);
} }
@Override @Override

View File

@ -270,9 +270,9 @@ public class MockPlayer implements Player {
} }
@Override @Override
public void seekToDefaultPosition(int windowIndex) { public void seekToDefaultPosition(int mediaItemIndex) {
seekToDefaultPositionWithWindowIndexCalled = true; seekToDefaultPositionWithWindowIndexCalled = true;
seekWindowIndex = windowIndex; seekWindowIndex = mediaItemIndex;
countDownLatch.countDown(); countDownLatch.countDown();
} }
@ -284,9 +284,9 @@ public class MockPlayer implements Player {
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
seekToWithWindowIndexCalled = true; seekToWithWindowIndexCalled = true;
seekWindowIndex = windowIndex; seekWindowIndex = mediaItemIndex;
seekPositionMs = positionMs; seekPositionMs = positionMs;
countDownLatch.countDown(); countDownLatch.countDown();
} }
@ -665,11 +665,10 @@ public class MockPlayer implements Player {
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) {
setMediaItemsWithStartWindowIndexCalled = true; setMediaItemsWithStartWindowIndexCalled = true;
this.mediaItems = mediaItems; this.mediaItems = mediaItems;
this.startWindowIndex = startWindowIndex; this.startWindowIndex = startIndex;
this.startPositionMs = startPositionMs; this.startPositionMs = startPositionMs;
countDownLatch.countDown(); countDownLatch.countDown();
} }

View File

@ -208,8 +208,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
} }
@Override @Override
public void setMediaItems( public void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs) {
List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -400,7 +399,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
} }
@Override @Override
public void seekTo(int windowIndex, long positionMs) { public void seekTo(int mediaItemIndex, long positionMs) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }