Java Code Examples for com.google.android.exoplayer2.Player#TimelineChangeReason

The following examples show how to use com.google.android.exoplayer2.Player#TimelineChangeReason . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventLogger.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void onTimelineChanged(EventTime eventTime, @Player.TimelineChangeReason int reason) {
  int periodCount = eventTime.timeline.getPeriodCount();
  int windowCount = eventTime.timeline.getWindowCount();
  logd(
      "timeline ["
          + getEventTimeString(eventTime)
          + ", periodCount="
          + periodCount
          + ", windowCount="
          + windowCount
          + ", reason="
          + getTimelineChangeReasonString(reason));
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getPeriod(i, period);
    logd("  " + "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getWindow(i, window);
    logd(
        "  "
            + "window ["
            + getTimeString(window.getDurationMs())
            + ", "
            + window.isSeekable
            + ", "
            + window.isDynamic
            + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  logd("]");
}
 
Example 2
Source File: EventLogger.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static String getTimelineChangeReasonString(@Player.TimelineChangeReason int reason) {
  switch (reason) {
    case Player.TIMELINE_CHANGE_REASON_PREPARED:
      return "PREPARED";
    case Player.TIMELINE_CHANGE_REASON_RESET:
      return "RESET";
    case Player.TIMELINE_CHANGE_REASON_DYNAMIC:
      return "DYNAMIC";
    default:
      return "?";
  }
}
 
Example 3
Source File: EventLogger.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTimelineChanged(EventTime eventTime, @Player.TimelineChangeReason int reason) {
  int periodCount = eventTime.timeline.getPeriodCount();
  int windowCount = eventTime.timeline.getWindowCount();
  logd(
      "timelineChanged ["
          + getEventTimeString(eventTime)
          + ", periodCount="
          + periodCount
          + ", windowCount="
          + windowCount
          + ", reason="
          + getTimelineChangeReasonString(reason));
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getPeriod(i, period);
    logd("  " + "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getWindow(i, window);
    logd(
        "  "
            + "window ["
            + getTimeString(window.getDurationMs())
            + ", "
            + window.isSeekable
            + ", "
            + window.isDynamic
            + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  logd("]");
}
 
Example 4
Source File: AnalyticsCollector.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onTimelineChanged(
    Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
  mediaPeriodQueueTracker.onTimelineChanged(timeline);
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onTimelineChanged(eventTime, reason);
  }
}
 
Example 5
Source File: EventInfoForwarder.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put(Parameters.TIMELINE, String.valueOf(timeline));
    callingMethodParameters.put(Parameters.MANIFEST, String.valueOf(manifest));
    callingMethodParameters.put(Parameters.REASON, String.valueOf(reason));

    infoListener.onNewInfo(Methods.ON_TIMELINE_CHANGED, callingMethodParameters);
}
 
Example 6
Source File: AnalyticsCollector.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onTimelineChanged(
    Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
  mediaPeriodQueueTracker.onTimelineChanged(timeline);
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onTimelineChanged(eventTime, reason);
  }
}
 
Example 7
Source File: EventLogger.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static String getTimelineChangeReasonString(@Player.TimelineChangeReason int reason) {
  switch (reason) {
    case Player.TIMELINE_CHANGE_REASON_PREPARED:
      return "PREPARED";
    case Player.TIMELINE_CHANGE_REASON_RESET:
      return "RESET";
    case Player.TIMELINE_CHANGE_REASON_DYNAMIC:
      return "DYNAMIC";
    default:
      return "?";
  }
}
 
Example 8
Source File: EventLogger.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTimelineChanged(EventTime eventTime, @Player.TimelineChangeReason int reason) {
  int periodCount = eventTime.timeline.getPeriodCount();
  int windowCount = eventTime.timeline.getWindowCount();
  logd(
      "timelineChanged ["
          + getEventTimeString(eventTime)
          + ", periodCount="
          + periodCount
          + ", windowCount="
          + windowCount
          + ", reason="
          + getTimelineChangeReasonString(reason));
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getPeriod(i, period);
    logd("  " + "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getWindow(i, window);
    logd(
        "  "
            + "window ["
            + getTimeString(window.getDurationMs())
            + ", "
            + window.isSeekable
            + ", "
            + window.isDynamic
            + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  logd("]");
}
 
Example 9
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onTimelineChanged(
    Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
  mediaPeriodQueueTracker.onTimelineChanged(timeline);
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onTimelineChanged(eventTime, reason);
  }
}
 
Example 10
Source File: EventLogger.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static String getTimelineChangeReasonString(@Player.TimelineChangeReason int reason) {
  switch (reason) {
    case Player.TIMELINE_CHANGE_REASON_PREPARED:
      return "PREPARED";
    case Player.TIMELINE_CHANGE_REASON_RESET:
      return "RESET";
    case Player.TIMELINE_CHANGE_REASON_DYNAMIC:
      return "DYNAMIC";
    default:
      return "?";
  }
}
 
Example 11
Source File: EventLogger.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTimelineChanged(EventTime eventTime, @Player.TimelineChangeReason int reason) {
  int periodCount = eventTime.timeline.getPeriodCount();
  int windowCount = eventTime.timeline.getWindowCount();
  logd(
      "timelineChanged ["
          + getEventTimeString(eventTime)
          + ", periodCount="
          + periodCount
          + ", windowCount="
          + windowCount
          + ", reason="
          + getTimelineChangeReasonString(reason));
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getPeriod(i, period);
    logd("  " + "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    eventTime.timeline.getWindow(i, window);
    logd(
        "  "
            + "window ["
            + getTimeString(window.getDurationMs())
            + ", "
            + window.isSeekable
            + ", "
            + window.isDynamic
            + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    logd("  ...");
  }
  logd("]");
}
 
Example 12
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onTimelineChanged(
    Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
  mediaPeriodQueueTracker.onTimelineChanged(timeline);
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onTimelineChanged(eventTime, reason);
  }
}
 
Example 13
Source File: CustomizeControlView.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onTimelineChanged(
        Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    updateNavigation();
    updateTimeBarMode();
    updateProgress();
}
 
Example 14
Source File: EventLogger.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private static String getTimelineChangeReasonString(@Player.TimelineChangeReason int reason) {
  switch (reason) {
    case Player.TIMELINE_CHANGE_REASON_PREPARED:
      return "PREPARED";
    case Player.TIMELINE_CHANGE_REASON_RESET:
      return "RESET";
    case Player.TIMELINE_CHANGE_REASON_DYNAMIC:
      return "DYNAMIC";
    default:
      return "?";
  }
}
 
Example 15
Source File: AnalyticsCollector.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public final void onTimelineChanged(Timeline timeline, @Player.TimelineChangeReason int reason) {
  mediaPeriodQueueTracker.onTimelineChanged(timeline);
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onTimelineChanged(eventTime, reason);
  }
}
 
Example 16
Source File: OnPrepareForwarder.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    // TODO: should we send?
}
 
Example 17
Source File: OnCompletionForwarder.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    // TODO: should we send?
}
 
Example 18
Source File: PlayerOnErrorForwarder.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    // TODO: should we send?
}
 
Example 19
Source File: OnCompletionStateChangedForwarder.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    // TODO: should we send?
}
 
Example 20
Source File: EventListener.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
    for (Player.EventListener listener : listeners) {
        listener.onTimelineChanged(timeline, manifest, reason);
    }
}