diff --git a/library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java b/library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java index 64fbdd1853..fbf3e081f1 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java @@ -2203,6 +2203,7 @@ public abstract class SimpleBasePlayer extends BasePlayer { .setTotalBufferedDurationMs(PositionSupplier.ZERO) .setContentBufferedPositionMs(state.contentPositionMsSupplier) .setAdBufferedPositionMs(state.adPositionMsSupplier) + .setIsLoading(false) .build()); } @@ -2234,6 +2235,7 @@ public abstract class SimpleBasePlayer extends BasePlayer { .setTotalBufferedDurationMs(PositionSupplier.ZERO) .setContentBufferedPositionMs(state.contentPositionMsSupplier) .setAdBufferedPositionMs(state.adPositionMsSupplier) + .setIsLoading(false) .build(); } diff --git a/library/common/src/test/java/com/google/android/exoplayer2/SimpleBasePlayerTest.java b/library/common/src/test/java/com/google/android/exoplayer2/SimpleBasePlayerTest.java index db3c3d16ce..65ac7a13bb 100644 --- a/library/common/src/test/java/com/google/android/exoplayer2/SimpleBasePlayerTest.java +++ b/library/common/src/test/java/com/google/android/exoplayer2/SimpleBasePlayerTest.java @@ -2102,6 +2102,7 @@ public class SimpleBasePlayerTest { .setPlaylist( ImmutableList.of( new SimpleBasePlayer.MediaItemData.Builder(/* uid= */ new Object()).build())) + .setIsLoading(true) .build(); // Additionally set the repeat mode to see a difference between the placeholder and new state. State updatedState = @@ -2109,6 +2110,7 @@ public class SimpleBasePlayerTest { .buildUpon() .setPlaybackState(Player.STATE_IDLE) .setRepeatMode(Player.REPEAT_MODE_ALL) + .setIsLoading(false) .build(); SettableFuture future = SettableFuture.create(); SimpleBasePlayer player = @@ -2131,9 +2133,12 @@ public class SimpleBasePlayerTest { // Verify placeholder state and listener calls. assertThat(player.getPlaybackState()).isEqualTo(Player.STATE_IDLE); assertThat(player.getRepeatMode()).isEqualTo(Player.REPEAT_MODE_OFF); + assertThat(player.isLoading()).isFalse(); verify(listener).onPlaybackStateChanged(Player.STATE_IDLE); verify(listener) .onPlayerStateChanged(/* playWhenReady= */ false, /* playbackState= */ Player.STATE_IDLE); + verify(listener).onIsLoadingChanged(false); + verify(listener).onLoadingChanged(false); verifyNoMoreInteractions(listener); future.set(null); @@ -2218,6 +2223,7 @@ public class SimpleBasePlayerTest { .setPlaylist( ImmutableList.of( new SimpleBasePlayer.MediaItemData.Builder(/* uid= */ new Object()).build())) + .setIsLoading(true) .build(); // Additionally set the repeat mode to see a difference between the placeholder and new state. State updatedState = state.buildUpon().setRepeatMode(Player.REPEAT_MODE_ALL).build(); @@ -2239,8 +2245,9 @@ public class SimpleBasePlayerTest { player.release(); - // Verify initial change to IDLE without listener call. + // Verify initial change to IDLE and !isLoading without listener call. assertThat(player.getPlaybackState()).isEqualTo(Player.STATE_IDLE); + assertThat(player.isLoading()).isFalse(); verifyNoMoreInteractions(listener); future.set(null);