Java Code Examples for com.google.android.exoplayer2.C#usToMs()

The following examples show how to use com.google.android.exoplayer2.C#usToMs() . 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: PlaybackStatsListener.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Override
public void onAdPlaybackStarted(EventTime eventTime, String contentSession, String adSession) {
  Assertions.checkState(Assertions.checkNotNull(eventTime.mediaPeriodId).isAd());
  long contentPositionUs =
      eventTime
          .timeline
          .getPeriodByUid(eventTime.mediaPeriodId.periodUid, period)
          .getAdGroupTimeUs(eventTime.mediaPeriodId.adGroupIndex);
  EventTime contentEventTime =
      new EventTime(
          eventTime.realtimeMs,
          eventTime.timeline,
          eventTime.windowIndex,
          new MediaPeriodId(
              eventTime.mediaPeriodId.periodUid,
              eventTime.mediaPeriodId.windowSequenceNumber,
              eventTime.mediaPeriodId.adGroupIndex),
          /* eventPlaybackPositionMs= */ C.usToMs(contentPositionUs),
          eventTime.currentPlaybackPositionMs,
          eventTime.totalBufferedDurationMs);
  Assertions.checkNotNull(playbackStatsTrackers.get(contentSession))
      .onInterruptedByAd(contentEventTime);
}
 
Example 2
Source File: ClippingMediaSource.java    From K-Sonic with MIT License 6 votes vote down vote up
@Override
public Window getWindow(int windowIndex, Window window, boolean setIds,
    long defaultPositionProjectionUs) {
  window = timeline.getWindow(0, window, setIds, defaultPositionProjectionUs);
  window.durationUs = endUs != C.TIME_UNSET ? endUs - startUs : C.TIME_UNSET;
  if (window.defaultPositionUs != C.TIME_UNSET) {
    window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
    window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
        : Math.min(window.defaultPositionUs, endUs);
    window.defaultPositionUs -= startUs;
  }
  long startMs = C.usToMs(startUs);
  if (window.presentationStartTimeMs != C.TIME_UNSET) {
    window.presentationStartTimeMs += startMs;
  }
  if (window.windowStartTimeMs != C.TIME_UNSET) {
    window.windowStartTimeMs += startMs;
  }
  return window;
}
 
Example 3
Source File: ClippingMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Window getWindow(
    int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) {
  timeline.getWindow(
      /* windowIndex= */ 0, window, setTag, /* defaultPositionProjectionUs= */ 0);
  window.positionInFirstPeriodUs += startUs;
  window.durationUs = durationUs;
  window.isDynamic = isDynamic;
  if (window.defaultPositionUs != C.TIME_UNSET) {
    window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
    window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
        : Math.min(window.defaultPositionUs, endUs);
    window.defaultPositionUs -= startUs;
  }
  long startMs = C.usToMs(startUs);
  if (window.presentationStartTimeMs != C.TIME_UNSET) {
    window.presentationStartTimeMs += startMs;
  }
  if (window.windowStartTimeMs != C.TIME_UNSET) {
    window.windowStartTimeMs += startMs;
  }
  return window;
}
 
Example 4
Source File: ClippingMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Window getWindow(
    int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) {
  timeline.getWindow(
      /* windowIndex= */ 0, window, setTag, /* defaultPositionProjectionUs= */ 0);
  window.positionInFirstPeriodUs += startUs;
  window.durationUs = durationUs;
  window.isDynamic = isDynamic;
  if (window.defaultPositionUs != C.TIME_UNSET) {
    window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
    window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
        : Math.min(window.defaultPositionUs, endUs);
    window.defaultPositionUs -= startUs;
  }
  long startMs = C.usToMs(startUs);
  if (window.presentationStartTimeMs != C.TIME_UNSET) {
    window.presentationStartTimeMs += startMs;
  }
  if (window.windowStartTimeMs != C.TIME_UNSET) {
    window.windowStartTimeMs += startMs;
  }
  return window;
}
 
Example 5
Source File: ClippingMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Window getWindow(
    int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) {
  timeline.getWindow(
      /* windowIndex= */ 0, window, setTag, /* defaultPositionProjectionUs= */ 0);
  window.positionInFirstPeriodUs += startUs;
  window.durationUs = durationUs;
  window.isDynamic = isDynamic;
  if (window.defaultPositionUs != C.TIME_UNSET) {
    window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
    window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
        : Math.min(window.defaultPositionUs, endUs);
    window.defaultPositionUs -= startUs;
  }
  long startMs = C.usToMs(startUs);
  if (window.presentationStartTimeMs != C.TIME_UNSET) {
    window.presentationStartTimeMs += startMs;
  }
  if (window.windowStartTimeMs != C.TIME_UNSET) {
    window.windowStartTimeMs += startMs;
  }
  return window;
}
 
Example 6
Source File: FragmentedMp4Extractor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Advances {@link #firstSampleToOutputIndex} to point to the sync sample before the specified
 * seek time in the current fragment.
 *
 * @param timeUs The seek time, in microseconds.
 */
public void seek(long timeUs) {
  long timeMs = C.usToMs(timeUs);
  int searchIndex = currentSampleIndex;
  while (searchIndex < fragment.sampleCount
      && fragment.getSamplePresentationTime(searchIndex) < timeMs) {
    if (fragment.sampleIsSyncFrameTable[searchIndex]) {
      firstSampleToOutputIndex = searchIndex;
    }
    searchIndex++;
  }
}
 
Example 7
Source File: ClippingMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
  if (mediaTimeMs == C.TIME_UNSET) {
    return C.TIME_UNSET;
  }
  long startMs = C.usToMs(startUs);
  long clippedTimeMs = Math.max(0, mediaTimeMs - startMs);
  if (endUs != C.TIME_END_OF_SOURCE) {
    clippedTimeMs = Math.min(C.usToMs(endUs) - startMs, clippedTimeMs);
  }
  return clippedTimeMs;
}
 
Example 8
Source File: ClippingMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
  if (mediaTimeMs == C.TIME_UNSET) {
    return C.TIME_UNSET;
  }
  long startMs = C.usToMs(startUs);
  long clippedTimeMs = Math.max(0, mediaTimeMs - startMs);
  if (endUs != C.TIME_END_OF_SOURCE) {
    clippedTimeMs = Math.min(C.usToMs(endUs) - startMs, clippedTimeMs);
  }
  return clippedTimeMs;
}
 
Example 9
Source File: ClippingMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
  if (mediaTimeMs == C.TIME_UNSET) {
    return C.TIME_UNSET;
  }
  long startMs = C.usToMs(startUs);
  long clippedTimeMs = Math.max(0, mediaTimeMs - startMs);
  if (endUs != C.TIME_END_OF_SOURCE) {
    clippedTimeMs = Math.min(C.usToMs(endUs) - startMs, clippedTimeMs);
  }
  return clippedTimeMs;
}
 
Example 10
Source File: ClippingMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
protected long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
  if (mediaTimeMs == C.TIME_UNSET) {
    return C.TIME_UNSET;
  }
  long startMs = C.usToMs(startUs);
  long clippedTimeMs = Math.max(0, mediaTimeMs - startMs);
  if (endUs != C.TIME_END_OF_SOURCE) {
    clippedTimeMs = Math.min(C.usToMs(endUs) - startMs, clippedTimeMs);
  }
  return clippedTimeMs;
}
 
Example 11
Source File: ClippingMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
  if (mediaTimeMs == C.TIME_UNSET) {
    return C.TIME_UNSET;
  }
  long startMs = C.usToMs(startUs);
  long clippedTimeMs = Math.max(0, mediaTimeMs - startMs);
  if (endUs != C.TIME_END_OF_SOURCE) {
    clippedTimeMs = Math.min(C.usToMs(endUs) - startMs, clippedTimeMs);
  }
  return clippedTimeMs;
}
 
Example 12
Source File: FragmentedMp4Extractor.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Advances {@link #firstSampleToOutputIndex} to point to the sync sample before the specified
 * seek time in the current fragment.
 *
 * @param timeUs The seek time, in microseconds.
 */
public void seek(long timeUs) {
  long timeMs = C.usToMs(timeUs);
  int searchIndex = currentSampleIndex;
  while (searchIndex < fragment.sampleCount
      && fragment.getSamplePresentationTime(searchIndex) < timeMs) {
    if (fragment.sampleIsSyncFrameTable[searchIndex]) {
      firstSampleToOutputIndex = searchIndex;
    }
    searchIndex++;
  }
}
 
Example 13
Source File: FragmentedMp4Extractor.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Advances {@link #firstSampleToOutputIndex} to point to the sync sample before the specified
 * seek time in the current fragment.
 *
 * @param timeUs The seek time, in microseconds.
 */
public void seek(long timeUs) {
  long timeMs = C.usToMs(timeUs);
  int searchIndex = currentSampleIndex;
  while (searchIndex < fragment.sampleCount
      && fragment.getSamplePresentationTime(searchIndex) < timeMs) {
    if (fragment.sampleIsSyncFrameTable[searchIndex]) {
      firstSampleToOutputIndex = searchIndex;
    }
    searchIndex++;
  }
}
 
Example 14
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void processLoadedPlaylist(HlsMediaPlaylist loadedPlaylist, long loadDurationMs) {
  HlsMediaPlaylist oldPlaylist = playlistSnapshot;
  long currentTimeMs = SystemClock.elapsedRealtime();
  lastSnapshotLoadMs = currentTimeMs;
  playlistSnapshot = getLatestPlaylistSnapshot(oldPlaylist, loadedPlaylist);
  if (playlistSnapshot != oldPlaylist) {
    playlistError = null;
    lastSnapshotChangeMs = currentTimeMs;
    onPlaylistUpdated(playlistUrl, playlistSnapshot);
  } else if (!playlistSnapshot.hasEndTag) {
    if (loadedPlaylist.mediaSequence + loadedPlaylist.segments.size()
        < playlistSnapshot.mediaSequence) {
      // TODO: Allow customization of playlist resets handling.
      // The media sequence jumped backwards. The server has probably reset. We do not try
      // blacklisting in this case.
      playlistError = new PlaylistResetException(playlistUrl);
      notifyPlaylistError(playlistUrl, C.TIME_UNSET);
    } else if (currentTimeMs - lastSnapshotChangeMs
        > C.usToMs(playlistSnapshot.targetDurationUs)
            * playlistStuckTargetDurationCoefficient) {
      // TODO: Allow customization of stuck playlists handling.
      playlistError = new PlaylistStuckException(playlistUrl);
      long blacklistDurationMs =
          loadErrorHandlingPolicy.getBlacklistDurationMsFor(
              C.DATA_TYPE_MANIFEST, loadDurationMs, playlistError, /* errorCount= */ 1);
      notifyPlaylistError(playlistUrl, blacklistDurationMs);
      if (blacklistDurationMs != C.TIME_UNSET) {
        blacklistPlaylist(blacklistDurationMs);
      }
    }
  }
  // Do not allow the playlist to load again within the target duration if we obtained a new
  // snapshot, or half the target duration otherwise.
  earliestNextLoadTimeMs =
      currentTimeMs
          + C.usToMs(
              playlistSnapshot != oldPlaylist
                  ? playlistSnapshot.targetDurationUs
                  : (playlistSnapshot.targetDurationUs / 2));
  // Schedule a load if this is the primary playlist and it doesn't have an end tag. Else the
  // next load will be scheduled when refreshPlaylist is called, or when this playlist becomes
  // the primary.
  if (playlistUrl.equals(primaryMediaPlaylistUrl) && !playlistSnapshot.hasEndTag) {
    loadPlaylist();
  }
}
 
Example 15
Source File: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void processLoadedPlaylist(HlsMediaPlaylist loadedPlaylist, long loadDurationMs) {
  HlsMediaPlaylist oldPlaylist = playlistSnapshot;
  long currentTimeMs = SystemClock.elapsedRealtime();
  lastSnapshotLoadMs = currentTimeMs;
  playlistSnapshot = getLatestPlaylistSnapshot(oldPlaylist, loadedPlaylist);
  if (playlistSnapshot != oldPlaylist) {
    playlistError = null;
    lastSnapshotChangeMs = currentTimeMs;
    onPlaylistUpdated(playlistUrl, playlistSnapshot);
  } else if (!playlistSnapshot.hasEndTag) {
    if (loadedPlaylist.mediaSequence + loadedPlaylist.segments.size()
        < playlistSnapshot.mediaSequence) {
      // TODO: Allow customization of playlist resets handling.
      // The media sequence jumped backwards. The server has probably reset. We do not try
      // blacklisting in this case.
      playlistError = new PlaylistResetException(playlistUrl);
      notifyPlaylistError(playlistUrl, C.TIME_UNSET);
    } else if (currentTimeMs - lastSnapshotChangeMs
        > C.usToMs(playlistSnapshot.targetDurationUs)
            * playlistStuckTargetDurationCoefficient) {
      // TODO: Allow customization of stuck playlists handling.
      playlistError = new PlaylistStuckException(playlistUrl);
      long blacklistDurationMs =
          loadErrorHandlingPolicy.getBlacklistDurationMsFor(
              C.DATA_TYPE_MANIFEST, loadDurationMs, playlistError, /* errorCount= */ 1);
      notifyPlaylistError(playlistUrl, blacklistDurationMs);
      if (blacklistDurationMs != C.TIME_UNSET) {
        blacklistPlaylist(blacklistDurationMs);
      }
    }
  }
  // Do not allow the playlist to load again within the target duration if we obtained a new
  // snapshot, or half the target duration otherwise.
  earliestNextLoadTimeMs =
      currentTimeMs
          + C.usToMs(
              playlistSnapshot != oldPlaylist
                  ? playlistSnapshot.targetDurationUs
                  : (playlistSnapshot.targetDurationUs / 2));
  // Schedule a load if this is the primary playlist and it doesn't have an end tag. Else the
  // next load will be scheduled when refreshPlaylist is called, or when this playlist becomes
  // the primary.
  if (playlistUrl.equals(primaryMediaPlaylistUrl) && !playlistSnapshot.hasEndTag) {
    loadPlaylist();
  }
}
 
Example 16
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void processLoadedPlaylist(HlsMediaPlaylist loadedPlaylist) {
  // Update the loaded playlist with any inheritable information from the master playlist.
  loadedPlaylist = loadedPlaylist.copyWithMasterPlaylistInfo(masterPlaylist);

  HlsMediaPlaylist oldPlaylist = playlistSnapshot;
  long currentTimeMs = SystemClock.elapsedRealtime();
  lastSnapshotLoadMs = currentTimeMs;
  playlistSnapshot = getLatestPlaylistSnapshot(oldPlaylist, loadedPlaylist);
  if (playlistSnapshot != oldPlaylist) {
    playlistError = null;
    lastSnapshotChangeMs = currentTimeMs;
    onPlaylistUpdated(playlistUrl, playlistSnapshot);
  } else if (!playlistSnapshot.hasEndTag) {
    if (loadedPlaylist.mediaSequence + loadedPlaylist.segments.size()
        < playlistSnapshot.mediaSequence) {
      // TODO: Allow customization of playlist resets handling.
      // The media sequence jumped backwards. The server has probably reset.
      playlistError = new PlaylistResetException(playlistUrl.url);
      notifyPlaylistError(playlistUrl, false);
    } else if (currentTimeMs - lastSnapshotChangeMs
        > C.usToMs(playlistSnapshot.targetDurationUs)
            * PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT) {
      // TODO: Allow customization of stuck playlists handling.
      // The playlist seems to be stuck. Blacklist it.
      playlistError = new PlaylistStuckException(playlistUrl.url);
      notifyPlaylistError(playlistUrl, true);
      blacklistPlaylist();
    }
  }
  // Do not allow the playlist to load again within the target duration if we obtained a new
  // snapshot, or half the target duration otherwise.
  earliestNextLoadTimeMs =
      currentTimeMs
          + C.usToMs(
              playlistSnapshot != oldPlaylist
                  ? playlistSnapshot.targetDurationUs
                  : (playlistSnapshot.targetDurationUs / 2));
  // Schedule a load if this is the primary playlist and it doesn't have an end tag. Else the
  // next load will be scheduled when refreshPlaylist is called, or when this playlist becomes
  // the primary.
  if (playlistUrl == primaryHlsUrl && !playlistSnapshot.hasEndTag) {
    loadPlaylist();
  }
}
 
Example 17
Source File: MediaSourceEventListener.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private long adjustMediaTime(long mediaTimeUs) {
  long mediaTimeMs = C.usToMs(mediaTimeUs);
  return mediaTimeMs == C.TIME_UNSET ? C.TIME_UNSET : mediaTimeOffsetMs + mediaTimeMs;
}
 
Example 18
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void processLoadedPlaylist(HlsMediaPlaylist loadedPlaylist) {
  // Update the loaded playlist with any inheritable information from the master playlist.
  loadedPlaylist = loadedPlaylist.copyWithMasterPlaylistInfo(masterPlaylist);

  HlsMediaPlaylist oldPlaylist = playlistSnapshot;
  long currentTimeMs = SystemClock.elapsedRealtime();
  lastSnapshotLoadMs = currentTimeMs;
  playlistSnapshot = getLatestPlaylistSnapshot(oldPlaylist, loadedPlaylist);
  if (playlistSnapshot != oldPlaylist) {
    playlistError = null;
    lastSnapshotChangeMs = currentTimeMs;
    onPlaylistUpdated(playlistUrl, playlistSnapshot);
  } else if (!playlistSnapshot.hasEndTag) {
    if (loadedPlaylist.mediaSequence + loadedPlaylist.segments.size()
        < playlistSnapshot.mediaSequence) {
      // TODO: Allow customization of playlist resets handling.
      // The media sequence jumped backwards. The server has probably reset.
      playlistError = new PlaylistResetException(playlistUrl.url);
      notifyPlaylistError(playlistUrl, false);
    } else if (currentTimeMs - lastSnapshotChangeMs
        > C.usToMs(playlistSnapshot.targetDurationUs)
            * PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT) {
      // TODO: Allow customization of stuck playlists handling.
      // The playlist seems to be stuck. Blacklist it.
      playlistError = new PlaylistStuckException(playlistUrl.url);
      notifyPlaylistError(playlistUrl, true);
      blacklistPlaylist();
    }
  }
  // Do not allow the playlist to load again within the target duration if we obtained a new
  // snapshot, or half the target duration otherwise.
  earliestNextLoadTimeMs =
      currentTimeMs
          + C.usToMs(
              playlistSnapshot != oldPlaylist
                  ? playlistSnapshot.targetDurationUs
                  : (playlistSnapshot.targetDurationUs / 2));
  // Schedule a load if this is the primary playlist and it doesn't have an end tag. Else the
  // next load will be scheduled when refreshPlaylist is called, or when this playlist becomes
  // the primary.
  if (playlistUrl == primaryHlsUrl && !playlistSnapshot.hasEndTag) {
    loadPlaylist();
  }
}
 
Example 19
Source File: AdaptiveMediaSourceEventListener.java    From K-Sonic with MIT License 4 votes vote down vote up
private long adjustMediaTime(long mediaTimeUs) {
  long mediaTimeMs = C.usToMs(mediaTimeUs);
  return mediaTimeMs == C.TIME_UNSET ? C.TIME_UNSET : mediaTimeOffsetMs + mediaTimeMs;
}
 
Example 20
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void processLoadedPlaylist(HlsMediaPlaylist loadedPlaylist, long loadDurationMs) {
  HlsMediaPlaylist oldPlaylist = playlistSnapshot;
  long currentTimeMs = SystemClock.elapsedRealtime();
  lastSnapshotLoadMs = currentTimeMs;
  playlistSnapshot = getLatestPlaylistSnapshot(oldPlaylist, loadedPlaylist);
  if (playlistSnapshot != oldPlaylist) {
    playlistError = null;
    lastSnapshotChangeMs = currentTimeMs;
    onPlaylistUpdated(playlistUrl, playlistSnapshot);
  } else if (!playlistSnapshot.hasEndTag) {
    if (loadedPlaylist.mediaSequence + loadedPlaylist.segments.size()
        < playlistSnapshot.mediaSequence) {
      // TODO: Allow customization of playlist resets handling.
      // The media sequence jumped backwards. The server has probably reset. We do not try
      // blacklisting in this case.
      playlistError = new PlaylistResetException(playlistUrl);
      notifyPlaylistError(playlistUrl, C.TIME_UNSET);
    } else if (currentTimeMs - lastSnapshotChangeMs
        > C.usToMs(playlistSnapshot.targetDurationUs)
            * playlistStuckTargetDurationCoefficient) {
      // TODO: Allow customization of stuck playlists handling.
      playlistError = new PlaylistStuckException(playlistUrl);
      long blacklistDurationMs =
          loadErrorHandlingPolicy.getBlacklistDurationMsFor(
              C.DATA_TYPE_MANIFEST, loadDurationMs, playlistError, /* errorCount= */ 1);
      notifyPlaylistError(playlistUrl, blacklistDurationMs);
      if (blacklistDurationMs != C.TIME_UNSET) {
        blacklistPlaylist(blacklistDurationMs);
      }
    }
  }
  // Do not allow the playlist to load again within the target duration if we obtained a new
  // snapshot, or half the target duration otherwise.
  earliestNextLoadTimeMs =
      currentTimeMs
          + C.usToMs(
              playlistSnapshot != oldPlaylist
                  ? playlistSnapshot.targetDurationUs
                  : (playlistSnapshot.targetDurationUs / 2));
  // Schedule a load if this is the primary playlist and it doesn't have an end tag. Else the
  // next load will be scheduled when refreshPlaylist is called, or when this playlist becomes
  // the primary.
  if (playlistUrl.equals(primaryMediaPlaylistUrl) && !playlistSnapshot.hasEndTag) {
    loadPlaylist();
  }
}