use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
the class MediaSourceListTest method addMediaSources_expectTimelineUsesCustomShuffleOrder.
@Test
public void addMediaSources_expectTimelineUsesCustomShuffleOrder() {
Timeline timeline = mediaSourceList.addMediaSources(/* index= */
0, createFakeHolders(), new FakeShuffleOrder(MEDIA_SOURCE_LIST_SIZE));
assertTimelineUsesFakeShuffleOrder(timeline);
}
use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
the class MediaSourceListTest method removeMediaSourceRange_expectTimelineUsesCustomShuffleOrder.
@Test
public void removeMediaSourceRange_expectTimelineUsesCustomShuffleOrder() {
ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */
MEDIA_SOURCE_LIST_SIZE);
mediaSourceList.addMediaSources(/* index= */
0, createFakeHolders(), shuffleOrder);
Timeline timeline = mediaSourceList.removeMediaSourceRange(/* fromIndex= */
0, /* toIndex= */
2, new FakeShuffleOrder(/* length= */
2));
assertTimelineUsesFakeShuffleOrder(timeline);
}
use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
the class MediaSourceListTest method moveMediaSourceRange_expectTimelineUsesCustomShuffleOrder.
@Test
public void moveMediaSourceRange_expectTimelineUsesCustomShuffleOrder() {
ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */
MEDIA_SOURCE_LIST_SIZE);
mediaSourceList.addMediaSources(/* index= */
0, createFakeHolders(), shuffleOrder);
Timeline timeline = mediaSourceList.moveMediaSourceRange(/* fromIndex= */
0, /* toIndex= */
2, /* newFromIndex= */
2, new FakeShuffleOrder(MEDIA_SOURCE_LIST_SIZE));
assertTimelineUsesFakeShuffleOrder(timeline);
}
use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
the class MediaSourceListTest method moveMediaSources_expectTimelineUsesCustomShuffleOrder.
@Test
public void moveMediaSources_expectTimelineUsesCustomShuffleOrder() {
ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */
MEDIA_SOURCE_LIST_SIZE);
mediaSourceList.addMediaSources(/* index= */
0, createFakeHolders(), shuffleOrder);
Timeline timeline = mediaSourceList.moveMediaSource(/* currentIndex= */
0, /* newIndex= */
1, new FakeShuffleOrder(MEDIA_SOURCE_LIST_SIZE));
assertTimelineUsesFakeShuffleOrder(timeline);
}
use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
the class ExoPlayerTest method shuffleModeEnabledChanges.
@Test
public void shuffleModeEnabledChanges() throws Exception {
Timeline fakeTimeline = new FakeTimeline();
MediaSource[] fakeMediaSources = { new FakeMediaSource(fakeTimeline, ExoPlayerTestRunner.VIDEO_FORMAT), new FakeMediaSource(fakeTimeline, ExoPlayerTestRunner.VIDEO_FORMAT), new FakeMediaSource(fakeTimeline, ExoPlayerTestRunner.VIDEO_FORMAT) };
ConcatenatingMediaSource mediaSource = new ConcatenatingMediaSource(false, new FakeShuffleOrder(3), fakeMediaSources);
FakeRenderer renderer = new FakeRenderer(C.TRACK_TYPE_VIDEO);
ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).pause().waitForPlaybackState(Player.STATE_READY).setRepeatMode(Player.REPEAT_MODE_ALL).playUntilStartOfMediaItem(/* mediaItemIndex= */
1).setShuffleModeEnabled(true).playUntilStartOfMediaItem(/* mediaItemIndex= */
1).setShuffleModeEnabled(false).setRepeatMode(Player.REPEAT_MODE_OFF).play().build();
ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context).setMediaSources(mediaSource).setRenderers(renderer).setActionSchedule(actionSchedule).build().start().blockUntilEnded(TIMEOUT_MS);
testRunner.assertPlayedPeriodIndices(0, 1, 0, 2, 1, 2);
testRunner.assertPositionDiscontinuityReasonsEqual(Player.DISCONTINUITY_REASON_AUTO_TRANSITION, Player.DISCONTINUITY_REASON_AUTO_TRANSITION, Player.DISCONTINUITY_REASON_AUTO_TRANSITION, Player.DISCONTINUITY_REASON_AUTO_TRANSITION, Player.DISCONTINUITY_REASON_AUTO_TRANSITION);
assertThat(renderer.isEnded).isTrue();
}
Aggregations