@Test
public void testNotifyExternalEvents() throws Exception {

  MediaSource mediaSource = new FakeMediaSource(SINGLE_PERIOD_TIMELINE);
  ActionSchedule actionSchedule =
      new ActionSchedule.Builder("AnalyticsCollectorTest")
          .pause()
          .waitForPlaybackState(Player.STATE_READY)
          .executeRunnable(
              new PlayerRunnable() {
                @Override
                public void run(SimpleExoPlayer player) {
                  player.getAnalyticsCollector().notifySeekStarted();
                }
              })
          .seek(/* positionMs= */ 0)
          .play()
          .build();
  TestAnalyticsListener listener = runAnalyticsTest(mediaSource, actionSchedule);
  populateEventIds(SINGLE_PERIOD_TIMELINE);
  assertThat(listener.getEvents(EVENT_SEEK_STARTED)).containsExactly(period0);
  assertThat(listener.getEvents(EVENT_SEEK_PROCESSED)).containsExactly(period0);
}