Search in sources :

Example 16 with PlaceholderTimeline

use of androidx.media3.exoplayer.source.MaskingMediaSource.PlaceholderTimeline in project media by androidx.

the class ExoPlayerTest method stopAndSeekAfterStopDoesNotResetTimeline.

@Test
public void stopAndSeekAfterStopDoesNotResetTimeline() throws Exception {
    Timeline timeline = new FakeTimeline();
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).waitForPlaybackState(Player.STATE_READY).stop(false).stop(false).waitForPendingPlayerCommands().build();
    ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context).setTimeline(timeline).setActionSchedule(actionSchedule).build().start().blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
    testRunner.assertTimelinesSame(placeholderTimeline, timeline);
    testRunner.assertTimelineChangeReasonsEqual(Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE);
}
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) ActionSchedule(androidx.media3.test.utils.ActionSchedule) FakeTimeline(androidx.media3.test.utils.FakeTimeline) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) Test(org.junit.Test)

Example 17 with PlaceholderTimeline

use of androidx.media3.exoplayer.source.MaskingMediaSource.PlaceholderTimeline in project media by androidx.

the class ExoPlayerTest method reprepareAfterPlaybackError.

@Test
public void reprepareAfterPlaybackError() throws Exception {
    Timeline timeline = new FakeTimeline();
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).waitForPlaybackState(Player.STATE_READY).throwPlaybackException(ExoPlaybackException.createForSource(new IOException(), PlaybackException.ERROR_CODE_IO_UNSPECIFIED)).waitForPlaybackState(Player.STATE_IDLE).prepare().waitForPlaybackState(Player.STATE_BUFFERING).build();
    ExoPlayerTestRunner testRunner = new ExoPlayerTestRunner.Builder(context).setTimeline(timeline).setActionSchedule(actionSchedule).build();
    try {
        testRunner.start().blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
        fail();
    } catch (ExoPlaybackException e) {
    // Expected exception.
    }
    testRunner.assertTimelinesSame(placeholderTimeline, timeline);
    testRunner.assertTimelineChangeReasonsEqual(Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE);
}
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) ActionSchedule(androidx.media3.test.utils.ActionSchedule) FakeTimeline(androidx.media3.test.utils.FakeTimeline) TestExoPlayerBuilder(androidx.media3.test.utils.TestExoPlayerBuilder) ExoPlayerTestRunner(androidx.media3.test.utils.ExoPlayerTestRunner) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

FakeTimeline (androidx.media3.test.utils.FakeTimeline)17 Test (org.junit.Test)17 Timeline (androidx.media3.common.Timeline)16 SinglePeriodTimeline (androidx.media3.exoplayer.source.SinglePeriodTimeline)15 NoUidTimeline (androidx.media3.test.utils.NoUidTimeline)15 TestExoPlayerBuilder (androidx.media3.test.utils.TestExoPlayerBuilder)14 ActionSchedule (androidx.media3.test.utils.ActionSchedule)12 ExoPlayerTestRunner (androidx.media3.test.utils.ExoPlayerTestRunner)12 FakeMediaSource (androidx.media3.test.utils.FakeMediaSource)11 TimelineWindowDefinition (androidx.media3.test.utils.FakeTimeline.TimelineWindowDefinition)5 Listener (androidx.media3.common.Player.Listener)4 Player (androidx.media3.common.Player)3 ClippingMediaSource (androidx.media3.exoplayer.source.ClippingMediaSource)3 CompositeMediaSource (androidx.media3.exoplayer.source.CompositeMediaSource)3 ConcatenatingMediaSource (androidx.media3.exoplayer.source.ConcatenatingMediaSource)3 MaskingMediaSource (androidx.media3.exoplayer.source.MaskingMediaSource)3 MediaSource (androidx.media3.exoplayer.source.MediaSource)3 ServerSideAdInsertionMediaSource (androidx.media3.exoplayer.source.ads.ServerSideAdInsertionMediaSource)3 FakeAdaptiveMediaSource (androidx.media3.test.utils.FakeAdaptiveMediaSource)3 FakeRenderer (androidx.media3.test.utils.FakeRenderer)3