com.google.android.exoplayer2.offline.SegmentDownloader Java Examples

The following examples show how to use com.google.android.exoplayer2.offline.SegmentDownloader. 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 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 #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 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 #4
Source File: HlsDownloader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void addMediaPlaylistDataSpecs(List<Uri> mediaPlaylistUrls, List<DataSpec> out) {
  for (int i = 0; i < mediaPlaylistUrls.size(); i++) {
    out.add(SegmentDownloader.getCompressibleDataSpec(mediaPlaylistUrls.get(i)));
  }
}
 
Example #5
Source File: HlsDownloader.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void addMediaPlaylistDataSpecs(List<Uri> mediaPlaylistUrls, List<DataSpec> out) {
  for (int i = 0; i < mediaPlaylistUrls.size(); i++) {
    out.add(SegmentDownloader.getCompressibleDataSpec(mediaPlaylistUrls.get(i)));
  }
}
 
Example #6
Source File: HlsDownloader.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void addMediaPlaylistDataSpecs(List<Uri> mediaPlaylistUrls, List<DataSpec> out) {
  for (int i = 0; i < mediaPlaylistUrls.size(); i++) {
    out.add(SegmentDownloader.getCompressibleDataSpec(mediaPlaylistUrls.get(i)));
  }
}