Search in sources :

Example 1 with ExoPlayerTestRunner

use of androidx.media3.test.utils.ExoPlayerTestRunner in project media by androidx.

the class ExoPlayerTest method setMediaSources_whenIdle_correctMaskingPlaybackState.

@Test
public void setMediaSources_whenIdle_correctMaskingPlaybackState() throws Exception {
    final int[] maskingPlaybackStates = new int[4];
    Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).executeRunnable(new PlayerRunnable() {

        @Override
        public void run(ExoPlayer player) {
            // Set empty media item with no seek.
            player.setMediaSource(new ConcatenatingMediaSource());
            maskingPlaybackStates[0] = player.getPlaybackState();
        }
    }).executeRunnable(new PlayerRunnable() {

        @Override
        public void run(ExoPlayer player) {
            // Set media item with an implicit seek to the current position.
            player.setMediaSource(new FakeMediaSource());
            maskingPlaybackStates[1] = player.getPlaybackState();
        }
    }).executeRunnable(new PlayerRunnable() {

        @Override
        public void run(ExoPlayer player) {
            // Set media item with an explicit seek.
            player.setMediaSource(new FakeMediaSource(), /* startPositionMs= */
            C.TIME_UNSET);
            maskingPlaybackStates[2] = player.getPlaybackState();
        }
    }).executeRunnable(new PlayerRunnable() {

        @Override
        public void run(ExoPlayer player) {
            // Set empty media item with an explicit seek.
            player.setMediaSource(new ConcatenatingMediaSource(), /* startPositionMs= */
            C.TIME_UNSET);
            maskingPlaybackStates[3] = player.getPlaybackState();
        }
    }).prepare().build();
    ExoPlayerTestRunner exoPlayerTestRunner = new ExoPlayerTestRunner.Builder(context).skipSettingMediaSources().setActionSchedule(actionSchedule).build().start(/* doPrepare= */
    false).blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
    // Expect reset of masking to first media item.
    exoPlayerTestRunner.assertPlaybackStatesEqual(Player.STATE_ENDED);
    assertArrayEquals(new int[] { Player.STATE_IDLE, Player.STATE_IDLE, Player.STATE_IDLE, Player.STATE_IDLE }, maskingPlaybackStates);
    exoPlayerTestRunner.assertTimelineChangeReasonsEqual(Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED);
}
Also used : FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) ActionSchedule(androidx.media3.test.utils.ActionSchedule) PlayerRunnable(androidx.media3.test.utils.ActionSchedule.PlayerRunnable) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) ConcatenatingMediaSource(androidx.media3.exoplayer.source.ConcatenatingMediaSource) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) Test(org.junit.Test)

Example 2 with ExoPlayerTestRunner

use of androidx.media3.test.utils.ExoPlayerTestRunner in project media by androidx.

the class ExoPlayerTest method resetPlaylistWithPreviousPosition.

@Test
public void resetPlaylistWithPreviousPosition() throws Exception {
    Object firstWindowId = new Object();
    Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */
    1, /* id= */
    firstWindowId));
    Timeline firstExpectedMaskingTimeline = new MaskingMediaSource.PlaceholderTimeline(FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(firstWindowId).build());
    Object secondWindowId = new Object();
    Timeline secondTimeline = new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */
    1, /* id= */
    secondWindowId));
    Timeline secondExpectedMaskingTimeline = new MaskingMediaSource.PlaceholderTimeline(FakeTimeline.FAKE_MEDIA_ITEM.buildUpon().setTag(secondWindowId).build());
    MediaSource secondSource = new FakeMediaSource(secondTimeline);
    AtomicLong positionAfterReprepare = new AtomicLong();
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).pause().waitForPlaybackState(Player.STATE_READY).playUntilPosition(/* mediaItemIndex= */
    0, /* positionMs= */
    2000).setMediaSources(/* mediaItemIndex= */
    0, /* positionMs= */
    2000, secondSource).waitForTimelineChanged(secondTimeline, /* expectedReason */
    Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE).executeRunnable(new PlayerRunnable() {

        @Override
        public void run(ExoPlayer player) {
            positionAfterReprepare.set(player.getCurrentPosition());
        }
    }).play().build();
    ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context).setTimeline(timeline).setActionSchedule(actionSchedule).build().start().blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
    testRunner.assertTimelinesSame(firstExpectedMaskingTimeline, timeline, secondExpectedMaskingTimeline, secondTimeline);
    testRunner.assertTimelineChangeReasonsEqual(Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE);
    assertThat(positionAfterReprepare.get()).isAtLeast(2000L);
}
Also used : FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) ActionSchedule(androidx.media3.test.utils.ActionSchedule) PlayerRunnable(androidx.media3.test.utils.ActionSchedule.PlayerRunnable) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) Timeline(androidx.media3.common.Timeline) NoUidTimeline(androidx.media3.test.utils.NoUidTimeline) FakeTimeline(androidx.media3.test.utils.FakeTimeline) SinglePeriodTimeline(androidx.media3.exoplayer.source.SinglePeriodTimeline) AtomicLong(java.util.concurrent.atomic.AtomicLong) 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) FakeTimeline(androidx.media3.test.utils.FakeTimeline) TimelineWindowDefinition(androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) Test(org.junit.Test)

Example 3 with ExoPlayerTestRunner

use of androidx.media3.test.utils.ExoPlayerTestRunner in project media by androidx.

the class ExoPlayerTest method timelineUpdateDropsPrebufferedPeriods.

@Test
public void timelineUpdateDropsPrebufferedPeriods() throws Exception {
    Timeline timeline1 = new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */
    1, /* id= */
    1), new TimelineWindowDefinition(/* periodCount= */
    1, /* id= */
    2));
    final Timeline timeline2 = new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */
    1, /* id= */
    1), new TimelineWindowDefinition(/* periodCount= */
    1, /* id= */
    3));
    final FakeMediaSource mediaSource = new FakeMediaSource(timeline1, ExoPlayerTestRunner.VIDEO_FORMAT);
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).pause().waitForPlaybackState(Player.STATE_READY).playUntilPosition(/* mediaItemIndex= */
    0, /* positionMs= */
    Util.usToMs(TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US)).executeRunnable(() -> mediaSource.setNewSourceInfo(timeline2)).waitForTimelineChanged(timeline2, /* expectedReason */
    Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE).play().build();
    ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context).setMediaSources(mediaSource).setActionSchedule(actionSchedule).build().start().blockUntilEnded(TIMEOUT_MS);
    testRunner.assertTimelineChangeReasonsEqual(Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE);
    testRunner.assertPlayedPeriodIndices(0, 1);
    // Assert that the second period was re-created from the new timeline.
    assertThat(mediaSource.getCreatedMediaPeriods()).hasSize(3);
    assertThat(mediaSource.getCreatedMediaPeriods().get(0).periodUid).isEqualTo(timeline1.getUidOfPeriod(/* periodIndex= */
    0));
    assertThat(mediaSource.getCreatedMediaPeriods().get(1).periodUid).isEqualTo(timeline1.getUidOfPeriod(/* periodIndex= */
    1));
    assertThat(mediaSource.getCreatedMediaPeriods().get(2).periodUid).isEqualTo(timeline2.getUidOfPeriod(/* periodIndex= */
    1));
    assertThat(mediaSource.getCreatedMediaPeriods().get(1).windowSequenceNumber).isGreaterThan(mediaSource.getCreatedMediaPeriods().get(0).windowSequenceNumber);
    assertThat(mediaSource.getCreatedMediaPeriods().get(2).windowSequenceNumber).isGreaterThan(mediaSource.getCreatedMediaPeriods().get(1).windowSequenceNumber);
}
Also used : Timeline(androidx.media3.common.Timeline) NoUidTimeline(androidx.media3.test.utils.NoUidTimeline) FakeTimeline(androidx.media3.test.utils.FakeTimeline) SinglePeriodTimeline(androidx.media3.exoplayer.source.SinglePeriodTimeline) FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) ActionSchedule(androidx.media3.test.utils.ActionSchedule) FakeTimeline(androidx.media3.test.utils.FakeTimeline) TimelineWindowDefinition(androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) Test(org.junit.Test)

Example 4 with ExoPlayerTestRunner

use of androidx.media3.test.utils.ExoPlayerTestRunner in project media by androidx.

the class ExoPlayerTest method delegatingMediaSourceApproach.

@Test
public void delegatingMediaSourceApproach() throws Exception {
    Timeline fakeTimeline = new FakeTimeline(new TimelineWindowDefinition(/* isSeekable= */
    true, /* isDynamic= */
    false, /* durationUs= */
    10_000_000));
    final ConcatenatingMediaSource underlyingSource = new ConcatenatingMediaSource();
    CompositeMediaSource<Void> delegatingMediaSource = new CompositeMediaSource<Void>() {

        @Override
        public void prepareSourceInternal(@Nullable TransferListener mediaTransferListener) {
            super.prepareSourceInternal(mediaTransferListener);
            underlyingSource.addMediaSource(new FakeMediaSource(fakeTimeline, ExoPlayerTestRunner.VIDEO_FORMAT));
            underlyingSource.addMediaSource(new FakeMediaSource(fakeTimeline, ExoPlayerTestRunner.VIDEO_FORMAT));
            prepareChildSource(null, underlyingSource);
        }

        @Override
        public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
            return underlyingSource.createPeriod(id, allocator, startPositionUs);
        }

        @Override
        public void releasePeriod(MediaPeriod mediaPeriod) {
            underlyingSource.releasePeriod(mediaPeriod);
        }

        @Override
        protected void onChildSourceInfoRefreshed(Void id, MediaSource mediaSource, Timeline timeline) {
            refreshSourceInfo(timeline);
        }

        @Override
        public boolean isSingleWindow() {
            return false;
        }

        @Override
        public MediaItem getMediaItem() {
            return underlyingSource.getMediaItem();
        }

        @Override
        @Nullable
        public Timeline getInitialTimeline() {
            return Timeline.EMPTY;
        }
    };
    int[] currentMediaItemIndices = new int[1];
    long[] currentPlaybackPositions = new long[1];
    long[] windowCounts = new long[1];
    int seekToMediaItemIndex = 1;
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).seek(/* mediaItemIndex= */
    1, /* positionMs= */
    5000).waitForTimelineChanged(/* expectedTimeline= */
    null, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE).executeRunnable(new PlayerRunnable() {

        @Override
        public void run(ExoPlayer player) {
            currentMediaItemIndices[0] = player.getCurrentMediaItemIndex();
            currentPlaybackPositions[0] = player.getCurrentPosition();
            windowCounts[0] = player.getCurrentTimeline().getWindowCount();
        }
    }).build();
    ExoPlayerTestRunner exoPlayerTestRunner = new ExoPlayerTestRunner.Builder(context).setMediaSources(delegatingMediaSource).setActionSchedule(actionSchedule).build().start().blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
    exoPlayerTestRunner.assertTimelineChangeReasonsEqual(Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE);
    assertArrayEquals(new long[] { 2 }, windowCounts);
    assertArrayEquals(new int[] { seekToMediaItemIndex }, currentMediaItemIndices);
    assertArrayEquals(new long[] { 5_000 }, currentPlaybackPositions);
}
Also used : TransferListener(androidx.media3.datasource.TransferListener) Allocator(androidx.media3.exoplayer.upstream.Allocator) FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) ActionSchedule(androidx.media3.test.utils.ActionSchedule) PlayerRunnable(androidx.media3.test.utils.ActionSchedule.PlayerRunnable) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) CompositeMediaSource(androidx.media3.exoplayer.source.CompositeMediaSource) 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) FakeTimeline(androidx.media3.test.utils.FakeTimeline) TimelineWindowDefinition(androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition) ConcatenatingMediaSource(androidx.media3.exoplayer.source.ConcatenatingMediaSource) MediaPeriodId(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) FakeMediaPeriod(androidx.media3.test.utils.FakeMediaPeriod) MediaPeriod(androidx.media3.exoplayer.source.MediaPeriod) Nullable(androidx.annotation.Nullable) Test(org.junit.Test)

Example 5 with ExoPlayerTestRunner

use of androidx.media3.test.utils.ExoPlayerTestRunner in project media by androidx.

the class ExoPlayerTest method infiniteLoading_withSmallAllocations_oomIsPreventedByLoadControl_andThrowsStuckBufferingIllegalStateException.

@Test
public void infiniteLoading_withSmallAllocations_oomIsPreventedByLoadControl_andThrowsStuckBufferingIllegalStateException() {
    DefaultLoadControl loadControl = new DefaultLoadControl.Builder().setTargetBufferBytes(10 * C.DEFAULT_BUFFER_SEGMENT_SIZE).build();
    // Return no end of stream signal to prevent playback from ending.
    FakeMediaPeriod.TrackDataFactory trackDataWithoutEos = (format, periodId) -> ImmutableList.of();
    MediaSource continuouslyAllocatingMediaSource = new FakeMediaSource(new FakeTimeline(), ExoPlayerTestRunner.VIDEO_FORMAT) {

        @Override
        protected MediaPeriod createMediaPeriod(MediaPeriodId id, TrackGroupArray trackGroupArray, Allocator allocator, MediaSourceEventListener.EventDispatcher mediaSourceEventDispatcher, DrmSessionManager drmSessionManager, DrmSessionEventListener.EventDispatcher drmEventDispatcher, @Nullable TransferListener transferListener) {
            return new FakeMediaPeriod(trackGroupArray, allocator, trackDataWithoutEos, mediaSourceEventDispatcher, drmSessionManager, drmEventDispatcher, /* deferOnPrepared= */
            false) {

                private final List<Allocation> allocations = new ArrayList<>();

                private Callback callback;

                @Override
                public synchronized void prepare(Callback callback, long positionUs) {
                    this.callback = callback;
                    super.prepare(callback, positionUs);
                }

                @Override
                public long getBufferedPositionUs() {
                    // Pretend not to make loading progress, so that continueLoading keeps being called.
                    return 0;
                }

                @Override
                public long getNextLoadPositionUs() {
                    // Pretend not to make loading progress, so that continueLoading keeps being called.
                    return 0;
                }

                @Override
                public boolean continueLoading(long positionUs) {
                    allocations.add(allocator.allocate());
                    callback.onContinueLoadingRequested(this);
                    return true;
                }
            };
        }
    };
    ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context).setMediaSources(continuouslyAllocatingMediaSource).setLoadControl(loadControl).build();
    ExoPlaybackException exception = assertThrows(ExoPlaybackException.class, () -> testRunner.start().blockUntilEnded(TIMEOUT_MS));
    assertThat(exception.type).isEqualTo(ExoPlaybackException.TYPE_UNEXPECTED);
    assertThat(exception.getUnexpectedException()).isInstanceOf(IllegalStateException.class);
}
Also used : IllegalSeekPositionException(androidx.media3.common.IllegalSeekPositionException) COMMAND_ADJUST_DEVICE_VOLUME(androidx.media3.common.Player.COMMAND_ADJUST_DEVICE_VOLUME) Arrays(java.util.Arrays) ArgumentMatchers(org.mockito.ArgumentMatchers) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Uri(android.net.Uri) COMMAND_SEEK_TO_NEXT_MEDIA_ITEM(androidx.media3.common.Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM) COMMAND_GET_CURRENT_MEDIA_ITEM(androidx.media3.common.Player.COMMAND_GET_CURRENT_MEDIA_ITEM) Allocator(androidx.media3.exoplayer.upstream.Allocator) COMMAND_GET_MEDIA_ITEMS_METADATA(androidx.media3.common.Player.COMMAND_GET_MEDIA_ITEMS_METADATA) CompositeMediaSource(androidx.media3.exoplayer.source.CompositeMediaSource) DefaultTrackSelector(androidx.media3.exoplayer.trackselection.DefaultTrackSelector) COMMAND_SEEK_TO_MEDIA_ITEM(androidx.media3.common.Player.COMMAND_SEEK_TO_MEDIA_ITEM) COMMAND_GET_TIMELINE(androidx.media3.common.Player.COMMAND_GET_TIMELINE) ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState(androidx.media3.exoplayer.source.ads.ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState) Looper(android.os.Looper) COMMAND_SET_REPEAT_MODE(androidx.media3.common.Player.COMMAND_SET_REPEAT_MODE) ClippingMediaSource(androidx.media3.exoplayer.source.ClippingMediaSource) Surface(android.view.Surface) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) Range(com.google.common.collect.Range) FakeSampleStream(androidx.media3.test.utils.FakeSampleStream) TextInformationFrame(androidx.media3.extractor.metadata.id3.TextInformationFrame) TestPlayerRunHelper(androidx.media3.test.utils.robolectric.TestPlayerRunHelper) CountDownLatch(java.util.concurrent.CountDownLatch) Nullable(androidx.annotation.Nullable) Allocation(androidx.media3.exoplayer.upstream.Allocation) ArgumentMatchers.anyFloat(org.mockito.ArgumentMatchers.anyFloat) Timeline(androidx.media3.common.Timeline) BinaryFrame(androidx.media3.extractor.metadata.id3.BinaryFrame) FakeRenderer(androidx.media3.test.utils.FakeRenderer) NoUidTimeline(androidx.media3.test.utils.NoUidTimeline) FakeClock(androidx.media3.test.utils.FakeClock) Mockito.mock(org.mockito.Mockito.mock) AnalyticsListener(androidx.media3.exoplayer.analytics.AnalyticsListener) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) Iterables(com.google.common.collect.Iterables) AdPlaybackState(androidx.media3.common.AdPlaybackState) Loader(androidx.media3.exoplayer.upstream.Loader) COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM(androidx.media3.common.Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM) TestPlayerRunHelper.runUntilPositionDiscontinuity(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilPositionDiscontinuity) RunWith(org.junit.runner.RunWith) Config(org.robolectric.annotation.Config) COMMAND_PLAY_PAUSE(androidx.media3.common.Player.COMMAND_PLAY_PAUSE) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) ArrayList(java.util.ArrayList) FakeTrackSelection(androidx.media3.test.utils.FakeTrackSelection) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) Assertions(androidx.media3.common.util.Assertions) DiscontinuityReason(androidx.media3.common.Player.DiscontinuityReason) COMMAND_SEEK_TO_DEFAULT_POSITION(androidx.media3.common.Player.COMMAND_SEEK_TO_DEFAULT_POSITION) Before(org.junit.Before) TransferListener(androidx.media3.datasource.TransferListener) MediaSourceEventListener(androidx.media3.exoplayer.source.MediaSourceEventListener) Player(androidx.media3.common.Player) ShadowLooper(org.robolectric.shadows.ShadowLooper) COMMAND_SET_DEVICE_VOLUME(androidx.media3.common.Player.COMMAND_SET_DEVICE_VOLUME) FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) TestPlayerRunHelper.runUntilSleepingForOffload(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilSleepingForOffload) Mockito.times(org.mockito.Mockito.times) IOException(java.io.IOException) Test(org.junit.Test) Listener(androidx.media3.common.Player.Listener) TestUtil.assertTimelinesSame(androidx.media3.test.utils.TestUtil.assertTimelinesSame) FakeShuffleOrder(androidx.media3.test.utils.FakeShuffleOrder) FakeMediaPeriod(androidx.media3.test.utils.FakeMediaPeriod) AtomicLong(java.util.concurrent.atomic.AtomicLong) Mockito.never(org.mockito.Mockito.never) COMMAND_GET_AUDIO_ATTRIBUTES(androidx.media3.common.Player.COMMAND_GET_AUDIO_ATTRIBUTES) FakeVideoRenderer(androidx.media3.test.utils.FakeVideoRenderer) COMMAND_GET_DEVICE_VOLUME(androidx.media3.common.Player.COMMAND_GET_DEVICE_VOLUME) MediaPeriodId(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId) Mockito.reset(org.mockito.Mockito.reset) FakeMediaSourceFactory(androidx.media3.test.utils.FakeMediaSourceFactory) COMMAND_SET_VIDEO_SURFACE(androidx.media3.common.Player.COMMAND_SET_VIDEO_SURFACE) COMMAND_SEEK_TO_PREVIOUS(androidx.media3.common.Player.COMMAND_SEEK_TO_PREVIOUS) PlayerRunnable(androidx.media3.test.utils.ActionSchedule.PlayerRunnable) COMMAND_CHANGE_MEDIA_ITEMS(androidx.media3.common.Player.COMMAND_CHANGE_MEDIA_ITEMS) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) Action(androidx.media3.test.utils.Action) Random(java.util.Random) MaskingMediaSource(androidx.media3.exoplayer.source.MaskingMediaSource) COMMAND_STOP(androidx.media3.common.Player.COMMAND_STOP) AndroidJUnit4(androidx.test.ext.junit.runners.AndroidJUnit4) AudioAttributes(androidx.media3.common.AudioAttributes) ApplicationProvider(androidx.test.core.app.ApplicationProvider) DrmSessionManager(androidx.media3.exoplayer.drm.DrmSessionManager) FakeTrackSelector(androidx.media3.test.utils.FakeTrackSelector) ArgumentMatcher(org.mockito.ArgumentMatcher) END_OF_STREAM_ITEM(androidx.media3.test.utils.FakeSampleStream.FakeSampleStreamItem.END_OF_STREAM_ITEM) COMMAND_SET_SPEED_AND_PITCH(androidx.media3.common.Player.COMMAND_SET_SPEED_AND_PITCH) FakeAdaptiveDataSet(androidx.media3.test.utils.FakeAdaptiveDataSet) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) FakeMediaClockRenderer(androidx.media3.test.utils.FakeMediaClockRenderer) Mockito.atLeast(org.mockito.Mockito.atLeast) Assert.fail(org.junit.Assert.fail) FakeSampleStreamItem(androidx.media3.test.utils.FakeSampleStream.FakeSampleStreamItem) MediaItem(androidx.media3.common.MediaItem) TestPlayerRunHelper.runUntilTimelineChanged(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilTimelineChanged) COMMAND_GET_TRACK_INFOS(androidx.media3.common.Player.COMMAND_GET_TRACK_INFOS) ServerSideAdInsertionMediaSource(androidx.media3.exoplayer.source.ads.ServerSideAdInsertionMediaSource) FakeChunkSource(androidx.media3.test.utils.FakeChunkSource) TestPlayerRunHelper.playUntilPosition(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.playUntilPosition) PlaybackException(androidx.media3.common.PlaybackException) TrackGroupArray(androidx.media3.common.TrackGroupArray) Util(androidx.media3.common.util.Util) Collectors(java.util.stream.Collectors) Format(androidx.media3.common.Format) COMMAND_SET_TRACK_SELECTION_PARAMETERS(androidx.media3.common.Player.COMMAND_SET_TRACK_SELECTION_PARAMETERS) COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM(androidx.media3.common.Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM) PlaybackParameters(androidx.media3.common.PlaybackParameters) List(java.util.List) FakeAdaptiveMediaSource(androidx.media3.test.utils.FakeAdaptiveMediaSource) TrackSelectionArray(androidx.media3.common.TrackSelectionArray) Mockito.inOrder(org.mockito.Mockito.inOrder) ConcatenatingMediaSource(androidx.media3.exoplayer.source.ConcatenatingMediaSource) AdditionalMatchers.not(org.mockito.AdditionalMatchers.not) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) TrackGroup(androidx.media3.common.TrackGroup) Context(android.content.Context) DEFAULT_WINDOW_DURATION_US(androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US) COMMAND_SET_SHUFFLE_MODE(androidx.media3.common.Player.COMMAND_SET_SHUFFLE_MODE) COMMAND_GET_TEXT(androidx.media3.common.Player.COMMAND_GET_TEXT) Assert.assertThrows(org.junit.Assert.assertThrows) MediaMetadata(androidx.media3.common.MediaMetadata) Metadata(androidx.media3.common.Metadata) TestPlayerRunHelper.runUntilPendingCommandsAreFullyHandled(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilPendingCommandsAreFullyHandled) TracksInfo(androidx.media3.common.TracksInfo) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestPlayerRunHelper.playUntilStartOfMediaItem(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.playUntilStartOfMediaItem) Intent(android.content.Intent) COMMAND_PREPARE(androidx.media3.common.Player.COMMAND_PREPARE) FakeTimeline(androidx.media3.test.utils.FakeTimeline) AtomicReference(java.util.concurrent.atomic.AtomicReference) Shadows.shadowOf(org.robolectric.Shadows.shadowOf) ActionSchedule(androidx.media3.test.utils.ActionSchedule) AudioManager(android.media.AudioManager) FakeDataSource(androidx.media3.test.utils.FakeDataSource) HashSet(java.util.HashSet) COMMAND_SEEK_FORWARD(androidx.media3.common.Player.COMMAND_SEEK_FORWARD) COMMAND_SET_VOLUME(androidx.media3.common.Player.COMMAND_SET_VOLUME) TimelineWindowDefinition(androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition) PlayerTarget(androidx.media3.test.utils.ActionSchedule.PlayerTarget) ArgumentCaptor(org.mockito.ArgumentCaptor) ShadowAudioManager(org.robolectric.shadows.ShadowAudioManager) SinglePeriodTimeline(androidx.media3.exoplayer.source.SinglePeriodTimeline) ImmutableList(com.google.common.collect.ImmutableList) DrmSessionEventListener(androidx.media3.exoplayer.drm.DrmSessionEventListener) Window(androidx.media3.common.Timeline.Window) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) RobolectricUtil.runMainLooperUntil(androidx.media3.test.utils.robolectric.RobolectricUtil.runMainLooperUntil) SurfaceTexture(android.graphics.SurfaceTexture) DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US(androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition.DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US) MediaSource(androidx.media3.exoplayer.source.MediaSource) InOrder(org.mockito.InOrder) COMMAND_SEEK_BACK(androidx.media3.common.Player.COMMAND_SEEK_BACK) MimeTypes(androidx.media3.common.MimeTypes) COMMAND_SEEK_TO_NEXT(androidx.media3.common.Player.COMMAND_SEEK_TO_NEXT) Clock(androidx.media3.common.util.Clock) Truth.assertThat(com.google.common.truth.Truth.assertThat) COMMAND_SET_MEDIA_ITEMS_METADATA(androidx.media3.common.Player.COMMAND_SET_MEDIA_ITEMS_METADATA) TestPlayerRunHelper.runUntilReceiveOffloadSchedulingEnabledNewState(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilReceiveOffloadSchedulingEnabledNewState) Mockito.verify(org.mockito.Mockito.verify) COMMAND_GET_VOLUME(androidx.media3.common.Player.COMMAND_GET_VOLUME) C(androidx.media3.common.C) Mockito(org.mockito.Mockito) PositionInfo(androidx.media3.common.Player.PositionInfo) FakeSampleStreamItem.oneByteSample(androidx.media3.test.utils.FakeSampleStream.FakeSampleStreamItem.oneByteSample) STATE_ENDED(androidx.media3.common.Player.STATE_ENDED) MediaPeriod(androidx.media3.exoplayer.source.MediaPeriod) Collections(java.util.Collections) TestPlayerRunHelper.runUntilPlaybackState(androidx.media3.test.utils.robolectric.TestPlayerRunHelper.runUntilPlaybackState) TransferListener(androidx.media3.datasource.TransferListener) Allocator(androidx.media3.exoplayer.upstream.Allocator) FakeMediaSource(androidx.media3.test.utils.FakeMediaSource) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) DrmSessionManager(androidx.media3.exoplayer.drm.DrmSessionManager) TrackGroupArray(androidx.media3.common.TrackGroupArray) FakeMediaPeriod(androidx.media3.test.utils.FakeMediaPeriod) 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) FakeTimeline(androidx.media3.test.utils.FakeTimeline) MediaPeriodId(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) Nullable(androidx.annotation.Nullable) Test(org.junit.Test)

Aggregations

ExoPlayerTestRunner (androidx.media3.test.utils.ExoPlayerTestRunner)51 Test (org.junit.Test)51 ActionSchedule (androidx.media3.test.utils.ActionSchedule)49 FakeTimeline (androidx.media3.test.utils.FakeTimeline)42 FakeMediaSource (androidx.media3.test.utils.FakeMediaSource)41 TestExoPlayerBuilder (androidx.media3.test.utils.TestExoPlayerBuilder)41 Timeline (androidx.media3.common.Timeline)33 SinglePeriodTimeline (androidx.media3.exoplayer.source.SinglePeriodTimeline)33 NoUidTimeline (androidx.media3.test.utils.NoUidTimeline)33 PlayerRunnable (androidx.media3.test.utils.ActionSchedule.PlayerRunnable)26 ConcatenatingMediaSource (androidx.media3.exoplayer.source.ConcatenatingMediaSource)23 ClippingMediaSource (androidx.media3.exoplayer.source.ClippingMediaSource)16 CompositeMediaSource (androidx.media3.exoplayer.source.CompositeMediaSource)16 MaskingMediaSource (androidx.media3.exoplayer.source.MaskingMediaSource)16 MediaSource (androidx.media3.exoplayer.source.MediaSource)16 ServerSideAdInsertionMediaSource (androidx.media3.exoplayer.source.ads.ServerSideAdInsertionMediaSource)16 FakeAdaptiveMediaSource (androidx.media3.test.utils.FakeAdaptiveMediaSource)16 TimelineWindowDefinition (androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition)15 TransferListener (androidx.media3.datasource.TransferListener)7 MediaPeriodId (androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)7