use of com.google.android.exoplayer2.testutil.FakeShuffleOrder in project ExoPlayer by google.
the class MediaPeriodQueueTest method setupTimeline.
private void setupTimeline(Timeline timeline) {
fakeMediaSource = new FakeMediaSource(timeline);
MediaSourceList.MediaSourceHolder mediaSourceHolder = new MediaSourceList.MediaSourceHolder(fakeMediaSource, /* useLazyPreparation= */
false);
mediaSourceList.setMediaSources(ImmutableList.of(mediaSourceHolder), new FakeShuffleOrder(/* length= */
1));
mediaSourceHolder.mediaSource.prepareSource(mock(MediaSourceCaller.class), /* mediaTransferListener */
null, PlayerId.UNSET);
Timeline playlistTimeline = mediaSourceList.createTimeline();
firstPeriodUid = playlistTimeline.getUidOfPeriod(/* periodIndex= */
0);
playbackInfo = new PlaybackInfo(playlistTimeline, mediaPeriodQueue.resolveMediaPeriodIdForAds(playlistTimeline, firstPeriodUid, /* positionUs= */
0), /* requestedContentPositionUs= */
C.TIME_UNSET, /* discontinuityStartPositionUs= */
0, Player.STATE_READY, /* playbackError= */
null, /* isLoading= */
false, /* trackGroups= */
null, /* trackSelectorResult= */
null, /* staticMetadata= */
ImmutableList.of(), /* loadingMediaPeriodId= */
null, /* playWhenReady= */
false, Player.PLAYBACK_SUPPRESSION_REASON_NONE, /* playbackParameters= */
PlaybackParameters.DEFAULT, /* bufferedPositionUs= */
0, /* totalBufferedDurationUs= */
0, /* positionUs= */
0, /* offloadSchedulingEnabled= */
false, /* sleepingForOffload= */
false);
}
use of com.google.android.exoplayer2.testutil.FakeShuffleOrder in project ExoPlayer by google.
the class MediaSourceListTest method setMediaSources_expectTimelineUsesCustomShuffleOrder.
@Test
public void setMediaSources_expectTimelineUsesCustomShuffleOrder() {
Timeline timeline = mediaSourceList.setMediaSources(createFakeHolders(), new FakeShuffleOrder(/* length=*/
4));
assertTimelineUsesFakeShuffleOrder(timeline);
}
use of com.google.android.exoplayer2.testutil.FakeShuffleOrder in project ExoPlayer by google.
the class ExoPlayerTest method setShuffleOrder_keepsCurrentPosition.
@Test
public void setShuffleOrder_keepsCurrentPosition() throws Exception {
AtomicLong positionAfterSetShuffleOrder = new AtomicLong(C.TIME_UNSET);
ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).playUntilPosition(0, 5000).setShuffleOrder(new FakeShuffleOrder(/* length= */
1)).executeRunnable(new PlayerRunnable() {
@Override
public void run(ExoPlayer player) {
positionAfterSetShuffleOrder.set(player.getCurrentPosition());
}
}).play().build();
new ExoPlayerTestRunner.Builder(context).setActionSchedule(actionSchedule).build().start().blockUntilEnded(TIMEOUT_MS);
assertThat(positionAfterSetShuffleOrder.get()).isAtLeast(5000);
}
use of com.google.android.exoplayer2.testutil.FakeShuffleOrder in project ExoPlayer by google.
the class ConcatenatingMediaSourceTest method atomicTimelineWindowOrder.
@Test
public void atomicTimelineWindowOrder() throws IOException {
// Release default test runner with non-atomic media source and replace with new test runner.
testRunner.release();
ConcatenatingMediaSource mediaSource = new ConcatenatingMediaSource(/* isAtomic= */
true, new FakeShuffleOrder(0));
testRunner = new MediaSourceTestRunner(mediaSource, null);
mediaSource.addMediaSources(Arrays.asList(createMediaSources(3)));
Timeline timeline = testRunner.prepareSource();
TimelineAsserts.assertWindowTags(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 2, 3);
TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, /* shuffleModeEnabled= */
false, C.INDEX_UNSET, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_OFF, /* shuffleModeEnabled= */
true, C.INDEX_UNSET, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, /* shuffleModeEnabled= */
false, 2, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ONE, /* shuffleModeEnabled= */
true, 2, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */
false, 2, 0, 1);
TimelineAsserts.assertPreviousWindowIndices(timeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */
true, 2, 0, 1);
TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, /* shuffleModeEnabled= */
false, 1, 2, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_OFF, /* shuffleModeEnabled= */
true, 1, 2, C.INDEX_UNSET);
TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, /* shuffleModeEnabled= */
false, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ONE, /* shuffleModeEnabled= */
true, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */
false, 1, 2, 0);
TimelineAsserts.assertNextWindowIndices(timeline, Player.REPEAT_MODE_ALL, /* shuffleModeEnabled= */
true, 1, 2, 0);
assertThat(timeline.getFirstWindowIndex(/* shuffleModeEnabled= */
false)).isEqualTo(0);
assertThat(timeline.getFirstWindowIndex(/* shuffleModeEnabled= */
true)).isEqualTo(0);
assertThat(timeline.getLastWindowIndex(/* shuffleModeEnabled= */
false)).isEqualTo(2);
assertThat(timeline.getLastWindowIndex(/* shuffleModeEnabled= */
true)).isEqualTo(2);
}
use of com.google.android.exoplayer2.testutil.FakeShuffleOrder in project ExoPlayer by google.
the class ConcatenatingMediaSourceTest method setUp.
@Before
public void setUp() throws Exception {
mediaSource = new ConcatenatingMediaSource(/* isAtomic= */
false, new FakeShuffleOrder(0));
testRunner = new MediaSourceTestRunner(mediaSource, null);
}
Aggregations