Search in sources :

Example 1 with FakeShuffleOrder

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);
}
Also used : Timeline(androidx.media3.common.Timeline) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Test(org.junit.Test)

Example 2 with FakeShuffleOrder

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);
}
Also used : ShuffleOrder(androidx.media3.exoplayer.source.ShuffleOrder) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Timeline(androidx.media3.common.Timeline) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Test(org.junit.Test)

Example 3 with FakeShuffleOrder

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);
}
Also used : ShuffleOrder(androidx.media3.exoplayer.source.ShuffleOrder) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Timeline(androidx.media3.common.Timeline) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Test(org.junit.Test)

Example 4 with FakeShuffleOrder

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);
}
Also used : ShuffleOrder(androidx.media3.exoplayer.source.ShuffleOrder) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Timeline(androidx.media3.common.Timeline) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Test(org.junit.Test)

Example 5 with FakeShuffleOrder

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();
}
Also used : FakeRenderer(androidx.media3.test.utils.FakeRenderer) Timeline(androidx.media3.common.Timeline) NoUidTimeline(androidx.media3.test.utils.NoUidTimeline) FakeTimeline(androidx.media3.test.utils.FakeTimeline) SinglePeriodTimeline(androidx.media3.exoplayer.source.SinglePeriodTimeline) CompositeMediaSource(androidx.media3.exoplayer.source.CompositeMediaSource) ClippingMediaSource(androidx.media3.exoplayer.source.ClippingMediaSource) FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) MaskingMediaSource(androidx.media3.exoplayer.source.MaskingMediaSource) ServerSideAdInsertionMediaSource(androidx.media3.exoplayer.source.ads.ServerSideAdInsertionMediaSource) FakeAdaptiveMediaSource(androidx.media3.test.utils.FakeAdaptiveMediaSource) ConcatenatingMediaSource(androidx.media3.exoplayer.source.ConcatenatingMediaSource) MediaSource(androidx.media3.exoplayer.source.MediaSource) FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) ActionSchedule(androidx.media3.test.utils.ActionSchedule) FakeTimeline(androidx.media3.test.utils.FakeTimeline) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) ConcatenatingMediaSource(androidx.media3.exoplayer.source.ConcatenatingMediaSource) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 FakeShuffleOrder (androidx.media3.test.utils.FakeShuffleOrder)15 Timeline (androidx.media3.common.Timeline)14 FakeTimeline (androidx.media3.test.utils.FakeTimeline)9 FakeMediaSource (androidx.media3.test.utils.FakeMediaSource)7 ConcatenatingMediaSource (androidx.media3.exoplayer.source.ConcatenatingMediaSource)5 ActionSchedule (androidx.media3.test.utils.ActionSchedule)5 TestExoPlayerBuilder (androidx.media3.test.utils.TestExoPlayerBuilder)5 SinglePeriodTimeline (androidx.media3.exoplayer.source.SinglePeriodTimeline)4 ClippingMediaSource (androidx.media3.exoplayer.source.ClippingMediaSource)3 CompositeMediaSource (androidx.media3.exoplayer.source.CompositeMediaSource)3 MaskingMediaSource (androidx.media3.exoplayer.source.MaskingMediaSource)3 MediaSource (androidx.media3.exoplayer.source.MediaSource)3 ShuffleOrder (androidx.media3.exoplayer.source.ShuffleOrder)3 ServerSideAdInsertionMediaSource (androidx.media3.exoplayer.source.ads.ServerSideAdInsertionMediaSource)3 ExoPlayerTestRunner (androidx.media3.test.utils.ExoPlayerTestRunner)3 FakeAdaptiveMediaSource (androidx.media3.test.utils.FakeAdaptiveMediaSource)3 NoUidTimeline (androidx.media3.test.utils.NoUidTimeline)3 PlayerRunnable (androidx.media3.test.utils.ActionSchedule.PlayerRunnable)2 MediaSourceTestRunner (androidx.media3.test.utils.MediaSourceTestRunner)2