com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist Java Examples

The following examples show how to use com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist. 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: HlsDownloader.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void addSegment(
    HlsMediaPlaylist mediaPlaylist,
    HlsMediaPlaylist.Segment segment,
    HashSet<Uri> seenEncryptionKeyUris,
    ArrayList<Segment> out) {
  String baseUri = mediaPlaylist.baseUri;
  long startTimeUs = mediaPlaylist.startTimeUs + segment.relativeStartTimeUs;
  if (segment.fullSegmentEncryptionKeyUri != null) {
    Uri keyUri = UriUtil.resolveToUri(baseUri, segment.fullSegmentEncryptionKeyUri);
    if (seenEncryptionKeyUris.add(keyUri)) {
      out.add(new Segment(startTimeUs, SegmentDownloader.getCompressibleDataSpec(keyUri)));
    }
  }
  Uri segmentUri = UriUtil.resolveToUri(baseUri, segment.url);
  DataSpec dataSpec =
      new DataSpec(segmentUri, segment.byterangeOffset, segment.byterangeLength, /* key= */ null);
  out.add(new Segment(startTimeUs, dataSpec));
}
 
Example #2
Source File: HlsDownloader.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void addSegment(
    HlsMediaPlaylist mediaPlaylist,
    HlsMediaPlaylist.Segment segment,
    HashSet<Uri> seenEncryptionKeyUris,
    ArrayList<Segment> out) {
  String baseUri = mediaPlaylist.baseUri;
  long startTimeUs = mediaPlaylist.startTimeUs + segment.relativeStartTimeUs;
  if (segment.fullSegmentEncryptionKeyUri != null) {
    Uri keyUri = UriUtil.resolveToUri(baseUri, segment.fullSegmentEncryptionKeyUri);
    if (seenEncryptionKeyUris.add(keyUri)) {
      out.add(new Segment(startTimeUs, SegmentDownloader.getCompressibleDataSpec(keyUri)));
    }
  }
  Uri segmentUri = UriUtil.resolveToUri(baseUri, segment.url);
  DataSpec dataSpec =
      new DataSpec(segmentUri, segment.byterangeOffset, segment.byterangeLength, /* key= */ null);
  out.add(new Segment(startTimeUs, dataSpec));
}
 
Example #3
Source File: HlsDownloader.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private void addSegment(
    HlsMediaPlaylist mediaPlaylist,
    HlsMediaPlaylist.Segment segment,
    HashSet<Uri> seenEncryptionKeyUris,
    ArrayList<Segment> out) {
  String baseUri = mediaPlaylist.baseUri;
  long startTimeUs = mediaPlaylist.startTimeUs + segment.relativeStartTimeUs;
  if (segment.fullSegmentEncryptionKeyUri != null) {
    Uri keyUri = UriUtil.resolveToUri(baseUri, segment.fullSegmentEncryptionKeyUri);
    if (seenEncryptionKeyUris.add(keyUri)) {
      out.add(new Segment(startTimeUs, SegmentDownloader.getCompressibleDataSpec(keyUri)));
    }
  }
  Uri segmentUri = UriUtil.resolveToUri(baseUri, segment.url);
  DataSpec dataSpec =
      new DataSpec(segmentUri, segment.byterangeOffset, segment.byterangeLength, /* key= */ null);
  out.add(new Segment(startTimeUs, dataSpec));
}
 
Example #4
Source File: HlsDownloader.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static void addSegment(
    ArrayList<Segment> segments,
    HlsMediaPlaylist mediaPlaylist,
    HlsMediaPlaylist.Segment hlsSegment,
    HashSet<Uri> seenEncryptionKeyUris) {
  long startTimeUs = mediaPlaylist.startTimeUs + hlsSegment.relativeStartTimeUs;
  if (hlsSegment.fullSegmentEncryptionKeyUri != null) {
    Uri keyUri = UriUtil.resolveToUri(mediaPlaylist.baseUri,
        hlsSegment.fullSegmentEncryptionKeyUri);
    if (seenEncryptionKeyUris.add(keyUri)) {
      segments.add(new Segment(startTimeUs, new DataSpec(keyUri)));
    }
  }
  Uri resolvedUri = UriUtil.resolveToUri(mediaPlaylist.baseUri, hlsSegment.url);
  segments.add(new Segment(startTimeUs,
      new DataSpec(resolvedUri, hlsSegment.byterangeOffset, hlsSegment.byterangeLength, null)));
}
 
Example #5
Source File: HlsDownloadHelper.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public TrackGroupArray getTrackGroups(int periodIndex) {
  Assertions.checkNotNull(playlist);
  if (playlist instanceof HlsMediaPlaylist) {
    renditionGroups = new int[0];
    return TrackGroupArray.EMPTY;
  }
  // TODO: Generate track groups as in playback. Reverse the mapping in getDownloadAction.
  HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) playlist;
  TrackGroup[] trackGroups = new TrackGroup[3];
  renditionGroups = new int[3];
  int trackGroupIndex = 0;
  if (!masterPlaylist.variants.isEmpty()) {
    renditionGroups[trackGroupIndex] = HlsMasterPlaylist.GROUP_INDEX_VARIANT;
    trackGroups[trackGroupIndex++] = new TrackGroup(toFormats(masterPlaylist.variants));
  }
  if (!masterPlaylist.audios.isEmpty()) {
    renditionGroups[trackGroupIndex] = HlsMasterPlaylist.GROUP_INDEX_AUDIO;
    trackGroups[trackGroupIndex++] = new TrackGroup(toFormats(masterPlaylist.audios));
  }
  if (!masterPlaylist.subtitles.isEmpty()) {
    renditionGroups[trackGroupIndex] = HlsMasterPlaylist.GROUP_INDEX_SUBTITLE;
    trackGroups[trackGroupIndex++] = new TrackGroup(toFormats(masterPlaylist.subtitles));
  }
  return new TrackGroupArray(Arrays.copyOf(trackGroups, trackGroupIndex));
}
 
Example #6
Source File: HlsDownloadHelper.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public TrackGroupArray getTrackGroups(int periodIndex) {
  Assertions.checkNotNull(playlist);
  if (playlist instanceof HlsMediaPlaylist) {
    renditionGroups = new int[0];
    return TrackGroupArray.EMPTY;
  }
  // TODO: Generate track groups as in playback. Reverse the mapping in getDownloadAction.
  HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) playlist;
  TrackGroup[] trackGroups = new TrackGroup[3];
  renditionGroups = new int[3];
  int trackGroupIndex = 0;
  if (!masterPlaylist.variants.isEmpty()) {
    renditionGroups[trackGroupIndex] = HlsMasterPlaylist.GROUP_INDEX_VARIANT;
    trackGroups[trackGroupIndex++] = new TrackGroup(toFormats(masterPlaylist.variants));
  }
  if (!masterPlaylist.audios.isEmpty()) {
    renditionGroups[trackGroupIndex] = HlsMasterPlaylist.GROUP_INDEX_AUDIO;
    trackGroups[trackGroupIndex++] = new TrackGroup(toFormats(masterPlaylist.audios));
  }
  if (!masterPlaylist.subtitles.isEmpty()) {
    renditionGroups[trackGroupIndex] = HlsMasterPlaylist.GROUP_INDEX_SUBTITLE;
    trackGroups[trackGroupIndex++] = new TrackGroup(toFormats(masterPlaylist.subtitles));
  }
  return new TrackGroupArray(Arrays.copyOf(trackGroups, trackGroupIndex));
}
 
Example #7
Source File: HlsDownloader.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static void addSegment(
    ArrayList<Segment> segments,
    HlsMediaPlaylist mediaPlaylist,
    HlsMediaPlaylist.Segment hlsSegment,
    HashSet<Uri> seenEncryptionKeyUris) {
  long startTimeUs = mediaPlaylist.startTimeUs + hlsSegment.relativeStartTimeUs;
  if (hlsSegment.fullSegmentEncryptionKeyUri != null) {
    Uri keyUri = UriUtil.resolveToUri(mediaPlaylist.baseUri,
        hlsSegment.fullSegmentEncryptionKeyUri);
    if (seenEncryptionKeyUris.add(keyUri)) {
      segments.add(new Segment(startTimeUs, new DataSpec(keyUri)));
    }
  }
  Uri resolvedUri = UriUtil.resolveToUri(mediaPlaylist.baseUri, hlsSegment.url);
  segments.add(new Segment(startTimeUs,
      new DataSpec(resolvedUri, hlsSegment.byterangeOffset, hlsSegment.byterangeLength, null)));
}
 
Example #8
Source File: ExoVideoPlaybackControlView.java    From ExoVideoView with Apache License 2.0 5 votes vote down vote up
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {
    if (manifest instanceof HlsManifest) {
        HlsManifest hlsManifest = (HlsManifest) manifest;
        isHls = !hlsManifest.mediaPlaylist.hasEndTag && hlsManifest.mediaPlaylist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_UNKNOWN;
    } else {
        isHls = false;
    }


    updateNavigation();
    updateTimeBarMode();
    updateProgress();
}
 
Example #9
Source File: HlsChunkSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
private static Uri getFullEncryptionKeyUri(HlsMediaPlaylist playlist, @Nullable Segment segment) {
  if (segment == null || segment.fullSegmentEncryptionKeyUri == null) {
    return null;
  }
  return UriUtil.resolveToUri(playlist.baseUri, segment.fullSegmentEncryptionKeyUri);
}
 
Example #10
Source File: HlsChunkSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the media sequence number of the segment to load next in {@code mediaPlaylist}.
 *
 * @param previous The last (at least partially) loaded segment.
 * @param switchingTrack Whether the segment to load is not preceded by a segment in the same
 *     track.
 * @param mediaPlaylist The media playlist to which the segment to load belongs.
 * @param startOfPlaylistInPeriodUs The start of {@code mediaPlaylist} relative to the period
 *     start in microseconds.
 * @param loadPositionUs The current load position relative to the period start in microseconds.
 * @return The media sequence of the segment to load.
 */
private long getChunkMediaSequence(
    @Nullable HlsMediaChunk previous,
    boolean switchingTrack,
    HlsMediaPlaylist mediaPlaylist,
    long startOfPlaylistInPeriodUs,
    long loadPositionUs) {
  if (previous == null || switchingTrack) {
    long endOfPlaylistInPeriodUs = startOfPlaylistInPeriodUs + mediaPlaylist.durationUs;
    long targetPositionInPeriodUs =
        (previous == null || independentSegments) ? loadPositionUs : previous.startTimeUs;
    if (!mediaPlaylist.hasEndTag && targetPositionInPeriodUs >= endOfPlaylistInPeriodUs) {
      // If the playlist is too old to contain the chunk, we need to refresh it.
      return mediaPlaylist.mediaSequence + mediaPlaylist.segments.size();
    }
    long targetPositionInPlaylistUs = targetPositionInPeriodUs - startOfPlaylistInPeriodUs;
    return Util.binarySearchFloor(
            mediaPlaylist.segments,
            /* value= */ targetPositionInPlaylistUs,
            /* inclusive= */ true,
            /* stayInBounds= */ !playlistTracker.isLive() || previous == null)
        + mediaPlaylist.mediaSequence;
  }
  // We ignore the case of previous not having loaded completely, in which case we load the next
  // segment.
  return previous.getNextChunkIndex();
}
 
Example #11
Source File: HlsChunkSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of {@link MediaChunkIterator}s for upcoming media chunks.
 *
 * @param previous The previous media chunk. May be null.
 * @param loadPositionUs The position at which the iterators will start.
 * @return Array of {@link MediaChunkIterator}s for each track.
 */
public MediaChunkIterator[] createMediaChunkIterators(
    @Nullable HlsMediaChunk previous, long loadPositionUs) {
  int oldTrackIndex = previous == null ? C.INDEX_UNSET : trackGroup.indexOf(previous.trackFormat);
  MediaChunkIterator[] chunkIterators = new MediaChunkIterator[trackSelection.length()];
  for (int i = 0; i < chunkIterators.length; i++) {
    int trackIndex = trackSelection.getIndexInTrackGroup(i);
    Uri playlistUrl = playlistUrls[trackIndex];
    if (!playlistTracker.isSnapshotValid(playlistUrl)) {
      chunkIterators[i] = MediaChunkIterator.EMPTY;
      continue;
    }
    HlsMediaPlaylist playlist =
        playlistTracker.getPlaylistSnapshot(playlistUrl, /* isForPlayback= */ false);
    long startOfPlaylistInPeriodUs =
        playlist.startTimeUs - playlistTracker.getInitialStartTimeUs();
    boolean switchingTrack = trackIndex != oldTrackIndex;
    long chunkMediaSequence =
        getChunkMediaSequence(
            previous, switchingTrack, playlist, startOfPlaylistInPeriodUs, loadPositionUs);
    if (chunkMediaSequence < playlist.mediaSequence) {
      chunkIterators[i] = MediaChunkIterator.EMPTY;
      continue;
    }
    int chunkIndex = (int) (chunkMediaSequence - playlist.mediaSequence);
    chunkIterators[i] =
        new HlsMediaPlaylistSegmentIterator(playlist, startOfPlaylistInPeriodUs, chunkIndex);
  }
  return chunkIterators;
}
 
Example #12
Source File: HlsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
private static Uri getFullEncryptionKeyUri(HlsMediaPlaylist playlist, @Nullable Segment segment) {
  if (segment == null || segment.fullSegmentEncryptionKeyUri == null) {
    return null;
  }
  return UriUtil.resolveToUri(playlist.baseUri, segment.fullSegmentEncryptionKeyUri);
}
 
Example #13
Source File: HlsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the media sequence number of the segment to load next in {@code mediaPlaylist}.
 *
 * @param previous The last (at least partially) loaded segment.
 * @param switchingTrack Whether the segment to load is not preceded by a segment in the same
 *     track.
 * @param mediaPlaylist The media playlist to which the segment to load belongs.
 * @param startOfPlaylistInPeriodUs The start of {@code mediaPlaylist} relative to the period
 *     start in microseconds.
 * @param loadPositionUs The current load position relative to the period start in microseconds.
 * @return The media sequence of the segment to load.
 */
private long getChunkMediaSequence(
    @Nullable HlsMediaChunk previous,
    boolean switchingTrack,
    HlsMediaPlaylist mediaPlaylist,
    long startOfPlaylistInPeriodUs,
    long loadPositionUs) {
  if (previous == null || switchingTrack) {
    long endOfPlaylistInPeriodUs = startOfPlaylistInPeriodUs + mediaPlaylist.durationUs;
    long targetPositionInPeriodUs =
        (previous == null || independentSegments) ? loadPositionUs : previous.startTimeUs;
    if (!mediaPlaylist.hasEndTag && targetPositionInPeriodUs >= endOfPlaylistInPeriodUs) {
      // If the playlist is too old to contain the chunk, we need to refresh it.
      return mediaPlaylist.mediaSequence + mediaPlaylist.segments.size();
    }
    long targetPositionInPlaylistUs = targetPositionInPeriodUs - startOfPlaylistInPeriodUs;
    return Util.binarySearchFloor(
            mediaPlaylist.segments,
            /* value= */ targetPositionInPlaylistUs,
            /* inclusive= */ true,
            /* stayInBounds= */ !playlistTracker.isLive() || previous == null)
        + mediaPlaylist.mediaSequence;
  }
  // We ignore the case of previous not having loaded completely, in which case we load the next
  // segment.
  return previous.getNextChunkIndex();
}
 
Example #14
Source File: HlsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of {@link MediaChunkIterator}s for upcoming media chunks.
 *
 * @param previous The previous media chunk. May be null.
 * @param loadPositionUs The position at which the iterators will start.
 * @return Array of {@link MediaChunkIterator}s for each track.
 */
public MediaChunkIterator[] createMediaChunkIterators(
    @Nullable HlsMediaChunk previous, long loadPositionUs) {
  int oldTrackIndex = previous == null ? C.INDEX_UNSET : trackGroup.indexOf(previous.trackFormat);
  MediaChunkIterator[] chunkIterators = new MediaChunkIterator[trackSelection.length()];
  for (int i = 0; i < chunkIterators.length; i++) {
    int trackIndex = trackSelection.getIndexInTrackGroup(i);
    Uri playlistUrl = playlistUrls[trackIndex];
    if (!playlistTracker.isSnapshotValid(playlistUrl)) {
      chunkIterators[i] = MediaChunkIterator.EMPTY;
      continue;
    }
    HlsMediaPlaylist playlist =
        playlistTracker.getPlaylistSnapshot(playlistUrl, /* isForPlayback= */ false);
    long startOfPlaylistInPeriodUs =
        playlist.startTimeUs - playlistTracker.getInitialStartTimeUs();
    boolean switchingTrack = trackIndex != oldTrackIndex;
    long chunkMediaSequence =
        getChunkMediaSequence(
            previous, switchingTrack, playlist, startOfPlaylistInPeriodUs, loadPositionUs);
    if (chunkMediaSequence < playlist.mediaSequence) {
      chunkIterators[i] = MediaChunkIterator.EMPTY;
      continue;
    }
    int chunkIndex = (int) (chunkMediaSequence - playlist.mediaSequence);
    chunkIterators[i] =
        new HlsMediaPlaylistSegmentIterator(playlist, startOfPlaylistInPeriodUs, chunkIndex);
  }
  return chunkIterators;
}
 
Example #15
Source File: HlsChunkSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an array of {@link MediaChunkIterator}s for upcoming media chunks.
 *
 * @param previous The previous media chunk. May be null.
 * @param loadPositionUs The position at which the iterators will start.
 * @return Array of {@link MediaChunkIterator}s for each track.
 */
public MediaChunkIterator[] createMediaChunkIterators(
    @Nullable HlsMediaChunk previous, long loadPositionUs) {
  int oldTrackIndex = previous == null ? C.INDEX_UNSET : trackGroup.indexOf(previous.trackFormat);
  MediaChunkIterator[] chunkIterators = new MediaChunkIterator[trackSelection.length()];
  for (int i = 0; i < chunkIterators.length; i++) {
    int trackIndex = trackSelection.getIndexInTrackGroup(i);
    Uri playlistUrl = playlistUrls[trackIndex];
    if (!playlistTracker.isSnapshotValid(playlistUrl)) {
      chunkIterators[i] = MediaChunkIterator.EMPTY;
      continue;
    }
    HlsMediaPlaylist playlist =
        playlistTracker.getPlaylistSnapshot(playlistUrl, /* isForPlayback= */ false);
    // Playlist snapshot is valid (checked by if() above) so playlist must be non-null.
    Assertions.checkNotNull(playlist);
    long startOfPlaylistInPeriodUs =
        playlist.startTimeUs - playlistTracker.getInitialStartTimeUs();
    boolean switchingTrack = trackIndex != oldTrackIndex;
    long chunkMediaSequence =
        getChunkMediaSequence(
            previous, switchingTrack, playlist, startOfPlaylistInPeriodUs, loadPositionUs);
    if (chunkMediaSequence < playlist.mediaSequence) {
      chunkIterators[i] = MediaChunkIterator.EMPTY;
      continue;
    }
    int chunkIndex = (int) (chunkMediaSequence - playlist.mediaSequence);
    chunkIterators[i] =
        new HlsMediaPlaylistSegmentIterator(playlist, startOfPlaylistInPeriodUs, chunkIndex);
  }
  return chunkIterators;
}
 
Example #16
Source File: HlsChunkSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the media sequence number of the segment to load next in {@code mediaPlaylist}.
 *
 * @param previous The last (at least partially) loaded segment.
 * @param switchingTrack Whether the segment to load is not preceded by a segment in the same
 *     track.
 * @param mediaPlaylist The media playlist to which the segment to load belongs.
 * @param startOfPlaylistInPeriodUs The start of {@code mediaPlaylist} relative to the period
 *     start in microseconds.
 * @param loadPositionUs The current load position relative to the period start in microseconds.
 * @return The media sequence of the segment to load.
 */
private long getChunkMediaSequence(
    @Nullable HlsMediaChunk previous,
    boolean switchingTrack,
    HlsMediaPlaylist mediaPlaylist,
    long startOfPlaylistInPeriodUs,
    long loadPositionUs) {
  if (previous == null || switchingTrack) {
    long endOfPlaylistInPeriodUs = startOfPlaylistInPeriodUs + mediaPlaylist.durationUs;
    long targetPositionInPeriodUs =
        (previous == null || independentSegments) ? loadPositionUs : previous.startTimeUs;
    if (!mediaPlaylist.hasEndTag && targetPositionInPeriodUs >= endOfPlaylistInPeriodUs) {
      // If the playlist is too old to contain the chunk, we need to refresh it.
      return mediaPlaylist.mediaSequence + mediaPlaylist.segments.size();
    }
    long targetPositionInPlaylistUs = targetPositionInPeriodUs - startOfPlaylistInPeriodUs;
    return Util.binarySearchFloor(
            mediaPlaylist.segments,
            /* value= */ targetPositionInPlaylistUs,
            /* inclusive= */ true,
            /* stayInBounds= */ !playlistTracker.isLive() || previous == null)
        + mediaPlaylist.mediaSequence;
  }
  // We ignore the case of previous not having loaded completely, in which case we load the next
  // segment.
  return previous.getNextChunkIndex();
}
 
Example #17
Source File: HlsChunkSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Uri getFullEncryptionKeyUri(HlsMediaPlaylist playlist, @Nullable Segment segment) {
  if (segment == null || segment.fullSegmentEncryptionKeyUri == null) {
    return null;
  }
  return UriUtil.resolveToUri(playlist.baseUri, segment.fullSegmentEncryptionKeyUri);
}
 
Example #18
Source File: HlsManifest.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * @param masterPlaylist The master playlist.
 * @param mediaPlaylist The media playlist.
 */
HlsManifest(HlsMasterPlaylist masterPlaylist, HlsMediaPlaylist mediaPlaylist) {
  this.masterPlaylist = masterPlaylist;
  this.mediaPlaylist = mediaPlaylist;
}
 
Example #19
Source File: HlsChunkSource.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void updateLiveEdgeTimeUs(HlsMediaPlaylist mediaPlaylist) {
  liveEdgeInPeriodTimeUs =
      mediaPlaylist.hasEndTag
          ? C.TIME_UNSET
          : (mediaPlaylist.getEndTimeUs() - playlistTracker.getInitialStartTimeUs());
}
 
Example #20
Source File: HlsChunkSource.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void updateLiveEdgeTimeUs(HlsMediaPlaylist mediaPlaylist) {
  liveEdgeInPeriodTimeUs =
      mediaPlaylist.hasEndTag
          ? C.TIME_UNSET
          : (mediaPlaylist.getEndTimeUs() - playlistTracker.getInitialStartTimeUs());
}
 
Example #21
Source File: HlsManifest.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param masterPlaylist The master playlist.
 * @param mediaPlaylist The media playlist.
 */
HlsManifest(HlsMasterPlaylist masterPlaylist, HlsMediaPlaylist mediaPlaylist) {
  this.masterPlaylist = masterPlaylist;
  this.mediaPlaylist = mediaPlaylist;
}
 
Example #22
Source File: HlsManifest.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param masterPlaylist The master playlist.
 * @param mediaPlaylist The media playlist.
 */
HlsManifest(HlsMasterPlaylist masterPlaylist, HlsMediaPlaylist mediaPlaylist) {
  this.masterPlaylist = masterPlaylist;
  this.mediaPlaylist = mediaPlaylist;
}
 
Example #23
Source File: HlsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void updateLiveEdgeTimeUs(HlsMediaPlaylist mediaPlaylist) {
  liveEdgeInPeriodTimeUs =
      mediaPlaylist.hasEndTag
          ? C.TIME_UNSET
          : (mediaPlaylist.getEndTimeUs() - playlistTracker.getInitialStartTimeUs());
}
 
Example #24
Source File: HlsChunkSource.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void updateLiveEdgeTimeUs(HlsMediaPlaylist mediaPlaylist) {
  liveEdgeInPeriodTimeUs =
      mediaPlaylist.hasEndTag
          ? C.TIME_UNSET
          : (mediaPlaylist.getEndTimeUs() - playlistTracker.getInitialStartTimeUs());
}
 
Example #25
Source File: HlsManifest.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param masterPlaylist The master playlist.
 * @param mediaPlaylist The media playlist.
 */
HlsManifest(HlsMasterPlaylist masterPlaylist, HlsMediaPlaylist mediaPlaylist) {
  this.masterPlaylist = masterPlaylist;
  this.mediaPlaylist = mediaPlaylist;
}
 
Example #26
Source File: HlsManifest.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param masterPlaylist The master playlist.
 * @param mediaPlaylist The media playlist.
 */
HlsManifest(HlsMasterPlaylist masterPlaylist, HlsMediaPlaylist mediaPlaylist) {
  this.masterPlaylist = masterPlaylist;
  this.mediaPlaylist = mediaPlaylist;
}
 
Example #27
Source File: HlsManifest.java    From K-Sonic with MIT License 4 votes vote down vote up
/**
 * @param masterPlaylist The master playlist.
 * @param mediaPlaylist The media playlist.
 */
HlsManifest(HlsMasterPlaylist masterPlaylist, HlsMediaPlaylist mediaPlaylist) {
  this.masterPlaylist = masterPlaylist;
  this.mediaPlaylist = mediaPlaylist;
}
 
Example #28
Source File: HlsChunkSource.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void updateLiveEdgeTimeUs(HlsMediaPlaylist mediaPlaylist) {
  liveEdgeInPeriodTimeUs =
      mediaPlaylist.hasEndTag
          ? C.TIME_UNSET
          : (mediaPlaylist.getEndTimeUs() - playlistTracker.getInitialStartTimeUs());
}
 
Example #29
Source File: HlsChunkSource.java    From Telegram-FOSS with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates iterator.
 *
 * @param playlist The {@link HlsMediaPlaylist} to wrap.
 * @param startOfPlaylistInPeriodUs The start time of the playlist in the period, in
 *     microseconds.
 * @param chunkIndex The index of the first available chunk in the playlist.
 */
public HlsMediaPlaylistSegmentIterator(
    HlsMediaPlaylist playlist, long startOfPlaylistInPeriodUs, int chunkIndex) {
  super(/* fromIndex= */ chunkIndex, /* toIndex= */ playlist.segments.size() - 1);
  this.playlist = playlist;
  this.startOfPlaylistInPeriodUs = startOfPlaylistInPeriodUs;
}
 
Example #30
Source File: HlsChunkSource.java    From MediaSDK with Apache License 2.0 3 votes vote down vote up
/**
 * Creates iterator.
 *
 * @param playlist The {@link HlsMediaPlaylist} to wrap.
 * @param startOfPlaylistInPeriodUs The start time of the playlist in the period, in
 *     microseconds.
 * @param chunkIndex The index of the first available chunk in the playlist.
 */
public HlsMediaPlaylistSegmentIterator(
    HlsMediaPlaylist playlist, long startOfPlaylistInPeriodUs, int chunkIndex) {
  super(/* fromIndex= */ chunkIndex, /* toIndex= */ playlist.segments.size() - 1);
  this.playlist = playlist;
  this.startOfPlaylistInPeriodUs = startOfPlaylistInPeriodUs;
}