use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
the class MediaSourceListTest method setMediaSources_expectTimelineUsesCustomShuffleOrder.
@Test
public void setMediaSources_expectTimelineUsesCustomShuffleOrder() {
Timeline timeline = mediaSourceList.setMediaSources(createFakeHolders(), new FakeShuffleOrder(/* length=*/
4));
assertTimelineUsesFakeShuffleOrder(timeline);
}
use of androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
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 androidx.media3.test.utils.FakeShuffleOrder in project media by androidx.
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);
}
Aggregations