diff --git a/library/core/src/androidTest/java/com/google/android/exoplayer2/ExoPlayerTest.java b/library/core/src/androidTest/java/com/google/android/exoplayer2/ExoPlayerTest.java index 7bbb6f9306..8d76e8793f 100644 --- a/library/core/src/androidTest/java/com/google/android/exoplayer2/ExoPlayerTest.java +++ b/library/core/src/androidTest/java/com/google/android/exoplayer2/ExoPlayerTest.java @@ -226,22 +226,22 @@ public final class ExoPlayerTest extends TestCase { final int[] actionSchedule = { // 0 -> 1 ExoPlayer.REPEAT_MODE_ONE, // 1 -> 1 ExoPlayer.REPEAT_MODE_OFF, // 1 -> 2 - -1, // 2 -> ended - ExoPlayer.REPEAT_MODE_ONE, // ended -> 2 + ExoPlayer.REPEAT_MODE_ONE, // 2 -> 2 ExoPlayer.REPEAT_MODE_ALL, // 2 -> 0 ExoPlayer.REPEAT_MODE_ONE, // 0 -> 0 -1, // 0 -> 0 ExoPlayer.REPEAT_MODE_OFF, // 0 -> 1 -1, // 1 -> 2 - -1, // 2 -> ended - -1 + -1 // 2 -> ended }; - int[] expectedWindowIndices = {1, 1, 2, 2, 2, 0, 0, 0, 1, 2, 2}; + int[] expectedWindowIndices = {1, 1, 2, 2, 0, 0, 0, 1, 2}; final LinkedList windowIndices = new LinkedList<>(); final CountDownLatch actionCounter = new CountDownLatch(actionSchedule.length); PlayerWrapper playerWrapper = new PlayerWrapper() { + @Override @SuppressWarnings("ResourceType") - private void executeAction() { + public void onPositionDiscontinuity() { + super.onPositionDiscontinuity(); int actionIndex = actionSchedule.length - (int) actionCounter.getCount(); if (actionSchedule[actionIndex] != -1) { player.setRepeatMode(actionSchedule[actionIndex]); @@ -249,20 +249,6 @@ public final class ExoPlayerTest extends TestCase { windowIndices.add(player.getCurrentWindowIndex()); actionCounter.countDown(); } - - @Override - public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { - super.onPlayerStateChanged(playWhenReady, playbackState); - if (playbackState == ExoPlayer.STATE_ENDED) { - executeAction(); - } - } - - @Override - public void onPositionDiscontinuity() { - super.onPositionDiscontinuity(); - executeAction(); - } }; MediaSource mediaSource = new FakeMediaSource(timeline, null, TEST_VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(TEST_VIDEO_FORMAT); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java index b6c9ef6f5d..6f54d5f9e1 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java @@ -488,11 +488,6 @@ import java.io.IOException; long newPositionUs = seekToPeriodPosition(periodId, playbackInfo.positionUs); playbackInfo = new PlaybackInfo(periodId, newPositionUs); } - - // Restart buffering if playback has ended and repetition is enabled. - if (state == ExoPlayer.STATE_ENDED && repeatMode != ExoPlayer.REPEAT_MODE_OFF) { - setState(ExoPlayer.STATE_BUFFERING); - } } private void startRenderers() throws ExoPlaybackException {