diff --git a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java index e3f075e562..6d479fef31 100644 --- a/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java +++ b/extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java @@ -640,7 +640,7 @@ public final class CastPlayer extends BasePlayer { } @Override - public int getCurrentWindowIndex() { + public int getCurrentMediaItemIndex() { return pendingSeekWindowIndex != C.INDEX_UNSET ? pendingSeekWindowIndex : currentWindowIndex; } diff --git a/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/FakePlayer.java b/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/FakePlayer.java index a958449b2a..d0a9d4206b 100644 --- a/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/FakePlayer.java +++ b/extensions/ima/src/test/java/com/google/android/exoplayer2/ext/ima/FakePlayer.java @@ -265,7 +265,7 @@ import com.google.android.exoplayer2.util.ListenerSet; } @Override - public int getCurrentWindowIndex() { + public int getCurrentMediaItemIndex() { return 0; } diff --git a/library/common/src/main/java/com/google/android/exoplayer2/BasePlayer.java b/library/common/src/main/java/com/google/android/exoplayer2/BasePlayer.java index da2e31d1d5..eeebb5e854 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/BasePlayer.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/BasePlayer.java @@ -144,25 +144,37 @@ public abstract class BasePlayer implements Player { @Deprecated @Override public final boolean hasPrevious() { - return hasPreviousWindow(); + return hasPreviousMediaItem(); + } + + @Deprecated + @Override + public final boolean hasPreviousWindow() { + return hasPreviousMediaItem(); } @Override - public final boolean hasPreviousWindow() { - return getPreviousWindowIndex() != C.INDEX_UNSET; + public final boolean hasPreviousMediaItem() { + return getPreviousMediaItemIndex() != C.INDEX_UNSET; } @Deprecated @Override public final void previous() { - seekToPreviousWindow(); + seekToPreviousMediaItem(); + } + + @Deprecated + @Override + public final void seekToPreviousWindow() { + seekToPreviousMediaItem(); } @Override - public final void seekToPreviousWindow() { - int previousWindowIndex = getPreviousWindowIndex(); - if (previousWindowIndex != C.INDEX_UNSET) { - seekToDefaultPosition(previousWindowIndex); + public final void seekToPreviousMediaItem() { + int previousMediaItemIndex = getPreviousMediaItemIndex(); + if (previousMediaItemIndex != C.INDEX_UNSET) { + seekToDefaultPosition(previousMediaItemIndex); } } @@ -187,25 +199,37 @@ public abstract class BasePlayer implements Player { @Deprecated @Override public final boolean hasNext() { - return hasNextWindow(); + return hasNextMediaItem(); + } + + @Deprecated + @Override + public final boolean hasNextWindow() { + return hasNextMediaItem(); } @Override - public final boolean hasNextWindow() { - return getNextWindowIndex() != C.INDEX_UNSET; + public final boolean hasNextMediaItem() { + return getNextMediaItemIndex() != C.INDEX_UNSET; } @Deprecated @Override public final void next() { - seekToNextWindow(); + seekToNextMediaItem(); + } + + @Deprecated + @Override + public final void seekToNextWindow() { + seekToNextMediaItem(); } @Override - public final void seekToNextWindow() { - int nextWindowIndex = getNextWindowIndex(); - if (nextWindowIndex != C.INDEX_UNSET) { - seekToDefaultPosition(nextWindowIndex); + public final void seekToNextMediaItem() { + int nextMediaItemIndex = getNextMediaItemIndex(); + if (nextMediaItemIndex != C.INDEX_UNSET) { + seekToDefaultPosition(nextMediaItemIndex); } } @@ -227,22 +251,40 @@ public abstract class BasePlayer implements Player { setPlaybackParameters(getPlaybackParameters().withSpeed(speed)); } + @Deprecated + @Override + public final int getCurrentWindowIndex() { + return getCurrentMediaItemIndex(); + } + + @Deprecated @Override public final int getNextWindowIndex() { + return getNextMediaItemIndex(); + } + + @Override + public final int getNextMediaItemIndex() { Timeline timeline = getCurrentTimeline(); return timeline.isEmpty() ? C.INDEX_UNSET : timeline.getNextWindowIndex( - getCurrentWindowIndex(), getRepeatModeForNavigation(), getShuffleModeEnabled()); + getCurrentMediaItemIndex(), getRepeatModeForNavigation(), getShuffleModeEnabled()); + } + + @Deprecated + @Override + public final int getPreviousWindowIndex() { + return getPreviousMediaItemIndex(); } @Override - public final int getPreviousWindowIndex() { + public final int getPreviousMediaItemIndex() { Timeline timeline = getCurrentTimeline(); return timeline.isEmpty() ? C.INDEX_UNSET : timeline.getPreviousWindowIndex( - getCurrentWindowIndex(), getRepeatModeForNavigation(), getShuffleModeEnabled()); + getCurrentMediaItemIndex(), getRepeatModeForNavigation(), getShuffleModeEnabled()); } @Override @@ -280,16 +322,28 @@ public abstract class BasePlayer implements Player { : duration == 0 ? 100 : Util.constrainValue((int) ((position * 100) / duration), 0, 100); } + @Deprecated @Override public final boolean isCurrentWindowDynamic() { - Timeline timeline = getCurrentTimeline(); - return !timeline.isEmpty() && timeline.getWindow(getCurrentWindowIndex(), window).isDynamic; + return isCurrentMediaItemDynamic(); } @Override - public final boolean isCurrentWindowLive() { + public final boolean isCurrentMediaItemDynamic() { Timeline timeline = getCurrentTimeline(); - return !timeline.isEmpty() && timeline.getWindow(getCurrentWindowIndex(), window).isLive(); + return !timeline.isEmpty() && timeline.getWindow(getCurrentMediaItemIndex(), window).isDynamic; + } + + @Deprecated + @Override + public final boolean isCurrentWindowLive() { + return isCurrentMediaItemLive(); + } + + @Override + public final boolean isCurrentMediaItemLive() { + Timeline timeline = getCurrentTimeline(); + return !timeline.isEmpty() && timeline.getWindow(getCurrentMediaItemIndex(), window).isLive(); } @Override @@ -305,10 +359,16 @@ public abstract class BasePlayer implements Player { return window.getCurrentUnixTimeMs() - window.windowStartTimeMs - getContentPosition(); } + @Deprecated @Override public final boolean isCurrentWindowSeekable() { + return isCurrentMediaItemSeekable(); + } + + @Override + public final boolean isCurrentMediaItemSeekable() { Timeline timeline = getCurrentTimeline(); - return !timeline.isEmpty() && timeline.getWindow(getCurrentWindowIndex(), window).isSeekable; + return !timeline.isEmpty() && timeline.getWindow(getCurrentMediaItemIndex(), window).isSeekable; } @Override diff --git a/library/common/src/main/java/com/google/android/exoplayer2/ForwardingPlayer.java b/library/common/src/main/java/com/google/android/exoplayer2/ForwardingPlayer.java index c45c48495b..62e113481d 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/ForwardingPlayer.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/ForwardingPlayer.java @@ -266,22 +266,34 @@ public class ForwardingPlayer implements Player { return player.hasPrevious(); } + @Deprecated @Override public boolean hasPreviousWindow() { return player.hasPreviousWindow(); } + @Override + public boolean hasPreviousMediaItem() { + return player.hasPreviousMediaItem(); + } + @Deprecated @Override public void previous() { player.previous(); } + @Deprecated @Override public void seekToPreviousWindow() { player.seekToPreviousWindow(); } + @Override + public void seekToPreviousMediaItem() { + player.seekToPreviousMediaItem(); + } + @Override public void seekToPrevious() { player.seekToPrevious(); @@ -298,22 +310,34 @@ public class ForwardingPlayer implements Player { return player.hasNext(); } + @Deprecated @Override public boolean hasNextWindow() { return player.hasNextWindow(); } + @Override + public boolean hasNextMediaItem() { + return player.hasNextMediaItem(); + } + @Deprecated @Override public void next() { player.next(); } + @Deprecated @Override public void seekToNextWindow() { player.seekToNextWindow(); } + @Override + public void seekToNextMediaItem() { + player.seekToNextMediaItem(); + } + @Override public void seekToNext() { player.seekToNext(); @@ -406,21 +430,39 @@ public class ForwardingPlayer implements Player { return player.getCurrentPeriodIndex(); } + @Deprecated @Override public int getCurrentWindowIndex() { return player.getCurrentWindowIndex(); } + @Override + public int getCurrentMediaItemIndex() { + return player.getCurrentMediaItemIndex(); + } + + @Deprecated @Override public int getNextWindowIndex() { return player.getNextWindowIndex(); } + @Override + public int getNextMediaItemIndex() { + return player.getNextMediaItemIndex(); + } + + @Deprecated @Override public int getPreviousWindowIndex() { return player.getPreviousWindowIndex(); } + @Override + public int getPreviousMediaItemIndex() { + return player.getPreviousMediaItemIndex(); + } + @Nullable @Override public MediaItem getCurrentMediaItem() { @@ -462,26 +504,44 @@ public class ForwardingPlayer implements Player { return player.getTotalBufferedDuration(); } + @Deprecated @Override public boolean isCurrentWindowDynamic() { return player.isCurrentWindowDynamic(); } + @Override + public boolean isCurrentMediaItemDynamic() { + return player.isCurrentMediaItemDynamic(); + } + + @Deprecated @Override public boolean isCurrentWindowLive() { return player.isCurrentWindowLive(); } + @Override + public boolean isCurrentMediaItemLive() { + return player.isCurrentMediaItemLive(); + } + @Override public long getCurrentLiveOffset() { return player.getCurrentLiveOffset(); } + @Deprecated @Override public boolean isCurrentWindowSeekable() { return player.isCurrentWindowSeekable(); } + @Override + public boolean isCurrentMediaItemSeekable() { + return player.isCurrentMediaItemSeekable(); + } + @Override public boolean isPlayingAd() { return player.isPlayingAd(); diff --git a/library/common/src/main/java/com/google/android/exoplayer2/Player.java b/library/common/src/main/java/com/google/android/exoplayer2/Player.java index c5a9e9c559..200db98a0e 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/Player.java @@ -80,9 +80,10 @@ public interface Player { /** * Called when the timeline has been refreshed. * - *
Note that the current window or period index may change as a result of a timeline change. - * If playback can't continue smoothly because of this timeline change, a separate {@link - * #onPositionDiscontinuity(PositionInfo, PositionInfo, int)} callback will be triggered. + *
Note that the current {@link MediaItem} or playback position may change as a result of a + * timeline change. If playback can't continue smoothly because of this timeline change, a + * separate {@link #onPositionDiscontinuity(PositionInfo, PositionInfo, int)} callback will be + * triggered. * *
{@link #onEvents(Player, Events)} will also be called to report this event along with * other events that happen in the same {@link Looper} message queue iteration. @@ -253,7 +254,7 @@ public interface Player { *
{@link #onEvents(Player, Events)} will also be called to report this event along with * other events that happen in the same {@link Looper} message queue iteration. * - * @param shuffleModeEnabled Whether shuffling of windows is enabled. + * @param shuffleModeEnabled Whether shuffling of {@link MediaItem media items} is enabled. */ default void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {} @@ -377,7 +378,7 @@ public interface Player { *
This method does not execute the command. * - *
Executing a command that is not available (for example, calling {@link #seekToNextWindow()} - * if {@link #COMMAND_SEEK_TO_NEXT_WINDOW} is unavailable) will neither throw an exception nor - * generate a {@link #getPlayerError()} player error}. + *
Executing a command that is not available (for example, calling {@link + * #seekToNextMediaItem()} if {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} is unavailable) will + * neither throw an exception nor generate a {@link #getPlayerError()} player error}. * - *
{@link #COMMAND_SEEK_TO_PREVIOUS_WINDOW} and {@link #COMMAND_SEEK_TO_NEXT_WINDOW} are - * unavailable if there is no such {@link MediaItem}. + *
{@link #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM} and {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} + * are unavailable if there is no such {@link MediaItem}. * * @param command A {@link Command}. * @return Whether the {@link Command} is available. @@ -1623,11 +1634,11 @@ public interface Player { * change. * *
Executing a command that is not available (for example, calling {@link #seekToNextWindow()} - * if {@link #COMMAND_SEEK_TO_NEXT_WINDOW} is unavailable) will neither throw an exception nor + * if {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} is unavailable) will neither throw an exception nor * generate a {@link #getPlayerError()} player error}. * - *
{@link #COMMAND_SEEK_TO_PREVIOUS_WINDOW} and {@link #COMMAND_SEEK_TO_NEXT_WINDOW} are - * unavailable if there is no such {@link MediaItem}. + *
{@link #COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM} and {@link #COMMAND_SEEK_TO_NEXT_MEDIA_ITEM} + * are unavailable if there is no such {@link MediaItem}. * * @return The currently available {@link Commands}. * @see Listener#onAvailableCommandsChanged @@ -1810,38 +1821,46 @@ public interface Player { /** Seeks forward in the current window by {@link #getSeekForwardIncrement()} milliseconds. */ void seekForward(); - /** @deprecated Use {@link #hasPreviousWindow()} instead. */ + /** @deprecated Use {@link #hasPreviousMediaItem()} instead. */ @Deprecated boolean hasPrevious(); + /** @deprecated Use {@link #hasPreviousMediaItem()} instead. */ + @Deprecated + boolean hasPreviousWindow(); + /** - * Returns whether a previous window exists, which may depend on the current repeat mode and + * Returns whether a previous media item exists, which may depend on the current repeat mode and * whether shuffle mode is enabled. * *
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 * details. */ - boolean hasPreviousWindow(); + boolean hasPreviousMediaItem(); - /** @deprecated Use {@link #seekToPreviousWindow()} instead. */ + /** @deprecated Use {@link #seekToPreviousMediaItem()} instead. */ @Deprecated void previous(); + /** @deprecated Use {@link #seekToPreviousMediaItem()} instead. */ + @Deprecated + void seekToPreviousWindow(); + /** - * Seeks to the default position of the previous window, which may depend on the current repeat - * mode and whether shuffle mode is enabled. Does nothing if {@link #hasPreviousWindow()} is - * {@code false}. + * Seeks to the default position of the previous {@link MediaItem}, which may depend on the + * current repeat mode and whether shuffle mode is enabled. Does nothing if {@link + * #hasPreviousMediaItem()} is {@code false}. * *
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 * details. */ - void seekToPreviousWindow(); + void seekToPreviousMediaItem(); /** - * Returns the maximum position for which {@link #seekToPrevious()} seeks to the previous window, - * in milliseconds. + * Returns the maximum position for which {@link #seekToPrevious()} seeks to the previous {@link + * MediaItem}, in milliseconds. * * @return The maximum seek to previous position, in milliseconds. * @see Listener#onMaxSeekToPreviousPositionChanged(long) @@ -1849,29 +1868,35 @@ public interface Player { long getMaxSeekToPreviousPosition(); /** - * Seeks to an earlier position in the current or previous window (if available). More precisely: + * Seeks to an earlier position in the current or previous {@link MediaItem} (if available). More + * precisely: * *
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 * details. */ - void seekToNextWindow(); + void seekToNextMediaItem(); /** - * Seeks to a later position in the current or next window (if available). More precisely: + * Seeks to a later position in the current or next {@link MediaItem} (if available). More + * precisely: * *
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 - * details. + * Returns the index of the current {@link MediaItem} in the {@link #getCurrentTimeline() + * timeline}, or the prospective index if the {@link #getCurrentTimeline() current timeline} is + * empty. */ + int getCurrentMediaItemIndex(); + + /** @deprecated Use {@link #getNextMediaItemIndex()} instead. */ + @Deprecated int getNextWindowIndex(); /** - * Returns the index of the window that will be played if {@link #seekToPreviousWindow()} is - * called, which may depend on the current repeat mode and whether shuffle mode is enabled. - * Returns {@link C#INDEX_UNSET} if {@link #hasPreviousWindow()} is {@code false}. + * Returns the index of the {@link MediaItem} that will be played if {@link + * #seekToNextMediaItem()} is called, which may depend on the current repeat mode and whether + * shuffle mode is enabled. Returns {@link C#INDEX_UNSET} if {@link #hasNextMediaItem()} is {@code + * false}. * *
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 * details. */ + int getNextMediaItemIndex(); + + /** @deprecated Use {@link #getPreviousMediaItemIndex()} instead. */ + @Deprecated int getPreviousWindowIndex(); /** - * Returns the media item of the current window in the timeline. May be null if the timeline is - * empty. + * Returns the index of the {@link MediaItem} that will be played if {@link + * #seekToPreviousMediaItem()} is called, which may depend on the current repeat mode and whether + * shuffle mode is enabled. Returns {@link C#INDEX_UNSET} if {@link #hasPreviousMediaItem()} is + * {@code false}. + * + *
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 + * details. + */ + int getPreviousMediaItemIndex(); + + /** + * Returns the currently playing {@link MediaItem}. May be null if the timeline is empty. * * @see Listener#onMediaItemTransition(MediaItem, int) */ @@ -2102,26 +2146,25 @@ public interface Player { MediaItem getMediaItemAt(@IntRange(from = 0) int index); /** - * Returns the duration of the current content window or ad in milliseconds, or {@link - * C#TIME_UNSET} if the duration is not known. + * Returns the duration of the current content or ad in milliseconds, or {@link C#TIME_UNSET} if + * the duration is not known. */ long getDuration(); /** - * Returns the playback position in the current content window or ad, in milliseconds, or the - * prospective position in milliseconds if the {@link #getCurrentTimeline() current timeline} is - * empty. + * Returns the playback position in the current content or ad, in milliseconds, or the prospective + * position in milliseconds if the {@link #getCurrentTimeline() current timeline} is empty. */ long getCurrentPosition(); /** - * Returns an estimate of the position in the current content window or ad up to which data is - * buffered, in milliseconds. + * Returns an estimate of the position in the current content or ad up to which data is buffered, + * in milliseconds. */ long getBufferedPosition(); /** - * Returns an estimate of the percentage in the current content window or ad up to which data is + * Returns an estimate of the percentage in the current content or ad up to which data is * buffered, or 0 if no estimate is available. */ @IntRange(from = 0, to = 100) @@ -2129,29 +2172,38 @@ public interface Player { /** * Returns an estimate of the total buffered duration from the current position, in milliseconds. - * This includes pre-buffered data for subsequent ads and windows. + * This includes pre-buffered data for subsequent ads and {@link MediaItem media items}. */ long getTotalBufferedDuration(); - /** - * Returns whether the current window is dynamic, or {@code false} if the {@link Timeline} is - * empty. - * - * @see Timeline.Window#isDynamic - */ + /** @deprecated Use {@link #isCurrentMediaItemDynamic()} instead. */ + @Deprecated boolean isCurrentWindowDynamic(); /** - * Returns whether the current window is live, or {@code false} if the {@link Timeline} is empty. + * Returns whether the current {@link MediaItem} is dynamic (may change when the {@link Timeline} + * is updated,) or {@code false} if the {@link Timeline} is empty. * - * @see Timeline.Window#isLive() + * @see Timeline.Window#isDynamic */ + boolean isCurrentMediaItemDynamic(); + + /** @deprecated Use {@link #isCurrentMediaItemLive()} instead. */ + @Deprecated boolean isCurrentWindowLive(); + /** + * Returns whether the current {@link MediaItem} is live, or {@code false} if the {@link Timeline} + * is empty. + * + * @see Timeline.Window#isLive() + */ + boolean isCurrentMediaItemLive(); + /** * Returns the offset of the current playback position from the live edge in milliseconds, or - * {@link C#TIME_UNSET} if the current window {@link #isCurrentWindowLive() isn't live} or the - * offset is unknown. + * {@link C#TIME_UNSET} if the current {@link MediaItem} {@link #isCurrentMediaItemLive()} isn't + * live} or the offset is unknown. * *
The offset is calculated as {@code currentTime - playbackPosition}, so should usually be * positive. @@ -2161,13 +2213,17 @@ public interface Player { */ long getCurrentLiveOffset(); + /** @deprecated Use {@link #isCurrentMediaItemSeekable()} instead. */ + @Deprecated + boolean isCurrentWindowSeekable(); + /** - * Returns whether the current window is seekable, or {@code false} if the {@link Timeline} is - * empty. + * Returns whether the current {@link MediaItem} is seekable, or {@code false} if the {@link + * Timeline} is empty. * * @see Timeline.Window#isSeekable */ - boolean isCurrentWindowSeekable(); + boolean isCurrentMediaItemSeekable(); /** Returns whether the player is currently playing an ad. */ boolean isPlayingAd(); @@ -2185,9 +2241,9 @@ public interface Player { int getCurrentAdIndexInAdGroup(); /** - * If {@link #isPlayingAd()} returns {@code true}, returns the duration of the current content - * window in milliseconds, or {@link C#TIME_UNSET} if the duration is not known. If there is no ad - * playing, the returned duration is the same as that returned by {@link #getDuration()}. + * If {@link #isPlayingAd()} returns {@code true}, returns the duration of the current content in + * milliseconds, or {@link C#TIME_UNSET} if the duration is not known. If there is no ad playing, + * the returned duration is the same as that returned by {@link #getDuration()}. */ long getContentDuration(); @@ -2200,8 +2256,8 @@ public interface Player { /** * If {@link #isPlayingAd()} returns {@code true}, returns an estimate of the content position in - * the current content window up to which data is buffered, in milliseconds. If there is no ad - * playing, the returned position is the same as that returned by {@link #getBufferedPosition()}. + * the current content up to which data is buffered, in milliseconds. If there is no ad playing, + * the returned position is the same as that returned by {@link #getBufferedPosition()}. */ long getContentBufferedPosition(); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java index d3d041ce93..ab669cb737 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java @@ -843,7 +843,7 @@ import java.util.concurrent.CopyOnWriteArraySet; } @Override - public int getCurrentWindowIndex() { + public int getCurrentMediaItemIndex() { int currentWindowIndex = getCurrentWindowIndexInternal(); return currentWindowIndex == C.INDEX_UNSET ? 0 : currentWindowIndex; } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java index eb5dc12060..589b196531 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java @@ -1502,7 +1502,7 @@ public class SimpleExoPlayer extends BasePlayer } @Override - public int getCurrentWindowIndex() { + public int getCurrentMediaItemIndex() { verifyApplicationThread(); return player.getCurrentWindowIndex(); } diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java index db307b52db..f46e394d38 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java @@ -505,7 +505,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer { } @Override - public int getCurrentWindowIndex() { + public int getCurrentMediaItemIndex() { throw new UnsupportedOperationException(); }