Search in sources :

Example 6 with EVENT_AUDIO_DECODER_INITIALIZED

use of com.google.android.exoplayer2.analytics.AnalyticsListener.EVENT_AUDIO_DECODER_INITIALIZED in project ExoPlayer by google.

the class DefaultAnalyticsCollectorTest method seekToOtherPeriod.

@Test
public void seekToOtherPeriod() throws Exception {
    MediaSource mediaSource = new ConcatenatingMediaSource(new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.VIDEO_FORMAT, ExoPlayerTestRunner.AUDIO_FORMAT), new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.AUDIO_FORMAT));
    ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).pause().waitForIsLoading(true).waitForIsLoading(false).seek(/* mediaItemIndex= */
    1, /* positionMs= */
    0).play().build();
    TestAnalyticsListener listener = runAnalyticsTest(mediaSource, actionSchedule);
    populateEventIds(listener.lastReportedTimeline);
    assertThat(listener.getEvents(EVENT_PLAYER_STATE_CHANGED)).containsExactly(WINDOW_0, /* setPlayWhenReady=true */
    WINDOW_0, /* BUFFERING */
    WINDOW_0, /* setPlayWhenReady=false */
    period0, /* READY */
    period1, /* BUFFERING */
    period1, /* setPlayWhenReady=true */
    period1, /* READY */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_TIMELINE_CHANGED)).containsExactly(WINDOW_0, /* PLAYLIST_CHANGED */
    period0).inOrder();
    assertThat(listener.getEvents(EVENT_POSITION_DISCONTINUITY)).containsExactly(period1);
    assertThat(listener.getEvents(EVENT_SEEK_STARTED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_SEEK_PROCESSED)).containsExactly(period1);
    assertThat(listener.getEvents(EVENT_IS_LOADING_CHANGED)).containsExactly(period0, period0).inOrder();
    assertThat(listener.getEvents(EVENT_TRACKS_CHANGED)).containsExactly(period0, period1, period1).inOrder();
    assertThat(listener.getEvents(EVENT_LOAD_STARTED)).containsExactly(WINDOW_0, /* manifest */
    WINDOW_1, /* manifest */
    period0, /* media */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_LOAD_COMPLETED)).containsExactly(WINDOW_0, /* manifest */
    WINDOW_1, /* manifest */
    period0, /* media */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_DOWNSTREAM_FORMAT_CHANGED)).containsExactly(period0, /* video */
    period0, /* audio */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_DECODER_ENABLED)).containsExactly(period0, /* video */
    period0, /* audio */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_DECODER_INIT)).containsExactly(period0, /* video */
    period0, /* audio */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_DECODER_FORMAT_CHANGED)).containsExactly(period0, /* video */
    period0, /* audio */
    period1).inOrder();
    assertThat(listener.getEvents(EVENT_DECODER_DISABLED)).containsExactly(period0, /* video */
    period0).inOrder();
    assertThat(listener.getEvents(EVENT_AUDIO_ENABLED)).containsExactly(period0, period1).inOrder();
    assertThat(listener.getEvents(EVENT_AUDIO_DECODER_INITIALIZED)).containsExactly(period0, period1).inOrder();
    assertThat(listener.getEvents(EVENT_AUDIO_INPUT_FORMAT_CHANGED)).containsExactly(period0, period1).inOrder();
    assertThat(listener.getEvents(EVENT_AUDIO_POSITION_ADVANCING)).containsExactly(period0, period1).inOrder();
    assertThat(listener.getEvents(EVENT_AUDIO_DISABLED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_VIDEO_ENABLED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_VIDEO_DECODER_INITIALIZED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_VIDEO_INPUT_FORMAT_CHANGED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_VIDEO_DISABLED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_VIDEO_SIZE_CHANGED)).containsExactly(period0);
    assertThat(listener.getEvents(EVENT_RENDERED_FIRST_FRAME)).containsExactly(period0);
    listener.assertNoMoreEvents();
}
Also used : ConcatenatingMediaSource(com.google.android.exoplayer2.source.ConcatenatingMediaSource) MediaSource(com.google.android.exoplayer2.source.MediaSource) FakeMediaSource(com.google.android.exoplayer2.testutil.FakeMediaSource) FakeMediaSource(com.google.android.exoplayer2.testutil.FakeMediaSource) ActionSchedule(com.google.android.exoplayer2.testutil.ActionSchedule) TestExoPlayerBuilder(com.google.android.exoplayer2.testutil.TestExoPlayerBuilder) ConcatenatingMediaSource(com.google.android.exoplayer2.source.ConcatenatingMediaSource) Test(org.junit.Test)

Aggregations

FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)6 Test (org.junit.Test)6 ConcatenatingMediaSource (com.google.android.exoplayer2.source.ConcatenatingMediaSource)4 MediaSource (com.google.android.exoplayer2.source.MediaSource)4 TestExoPlayerBuilder (com.google.android.exoplayer2.testutil.TestExoPlayerBuilder)3 ActionSchedule (com.google.android.exoplayer2.testutil.ActionSchedule)2 SurfaceTexture (android.graphics.SurfaceTexture)1 SparseArray (android.util.SparseArray)1 Surface (android.view.Surface)1 ExoPlayer (com.google.android.exoplayer2.ExoPlayer)1 Format (com.google.android.exoplayer2.Format)1 PlaybackParameters (com.google.android.exoplayer2.PlaybackParameters)1 Window (com.google.android.exoplayer2.Timeline.Window)1 FakeTimeline (com.google.android.exoplayer2.testutil.FakeTimeline)1 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1