com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist.Variant Java Examples

The following examples show how to use com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist.Variant. 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: HlsPlaylistParser.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Variant getVariantWithAudioGroup(ArrayList<Variant> variants, String groupId) {
  for (int i = 0; i < variants.size(); i++) {
    Variant variant = variants.get(i);
    if (groupId.equals(variant.audioGroupId)) {
      return variant;
    }
  }
  return null;
}
 
Example #2
Source File: HlsPlaylistParser.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Variant getVariantWithVideoGroup(ArrayList<Variant> variants, String groupId) {
  for (int i = 0; i < variants.size(); i++) {
    Variant variant = variants.get(i);
    if (groupId.equals(variant.videoGroupId)) {
      return variant;
    }
  }
  return null;
}
 
Example #3
Source File: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private boolean maybeSelectNewPrimaryUrl() {
  List<Variant> variants = masterPlaylist.variants;
  int variantsSize = variants.size();
  long currentTimeMs = SystemClock.elapsedRealtime();
  for (int i = 0; i < variantsSize; i++) {
    MediaPlaylistBundle bundle = playlistBundles.get(variants.get(i).url);
    if (currentTimeMs > bundle.blacklistUntilMs) {
      primaryMediaPlaylistUrl = bundle.playlistUrl;
      bundle.loadPlaylist();
      return true;
    }
  }
  return false;
}
 
Example #4
Source File: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/** Returns whether any of the variants in the master playlist have the specified playlist URL. */
private boolean isVariantUrl(Uri playlistUrl) {
  List<Variant> variants = masterPlaylist.variants;
  for (int i = 0; i < variants.size(); i++) {
    if (playlistUrl.equals(variants.get(i).url)) {
      return true;
    }
  }
  return false;
}
 
Example #5
Source File: HlsPlaylistParser.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static Variant getVariantWithAudioGroup(ArrayList<Variant> variants, String groupId) {
  for (int i = 0; i < variants.size(); i++) {
    Variant variant = variants.get(i);
    if (groupId.equals(variant.audioGroupId)) {
      return variant;
    }
  }
  return null;
}
 
Example #6
Source File: HlsPlaylistParser.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static Variant getVariantWithVideoGroup(ArrayList<Variant> variants, String groupId) {
  for (int i = 0; i < variants.size(); i++) {
    Variant variant = variants.get(i);
    if (groupId.equals(variant.videoGroupId)) {
      return variant;
    }
  }
  return null;
}
 
Example #7
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private boolean maybeSelectNewPrimaryUrl() {
  List<Variant> variants = masterPlaylist.variants;
  int variantsSize = variants.size();
  long currentTimeMs = SystemClock.elapsedRealtime();
  for (int i = 0; i < variantsSize; i++) {
    MediaPlaylistBundle bundle = playlistBundles.get(variants.get(i).url);
    if (currentTimeMs > bundle.blacklistUntilMs) {
      primaryMediaPlaylistUrl = bundle.playlistUrl;
      bundle.loadPlaylist();
      return true;
    }
  }
  return false;
}
 
Example #8
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/** Returns whether any of the variants in the master playlist have the specified playlist URL. */
private boolean isVariantUrl(Uri playlistUrl) {
  List<Variant> variants = masterPlaylist.variants;
  for (int i = 0; i < variants.size(); i++) {
    if (playlistUrl.equals(variants.get(i).url)) {
      return true;
    }
  }
  return false;
}
 
Example #9
Source File: HlsPlaylistParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private static Variant getVariantWithAudioGroup(ArrayList<Variant> variants, String groupId) {
  for (int i = 0; i < variants.size(); i++) {
    Variant variant = variants.get(i);
    if (groupId.equals(variant.audioGroupId)) {
      return variant;
    }
  }
  return null;
}
 
Example #10
Source File: HlsPlaylistParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private static Variant getVariantWithVideoGroup(ArrayList<Variant> variants, String groupId) {
  for (int i = 0; i < variants.size(); i++) {
    Variant variant = variants.get(i);
    if (groupId.equals(variant.videoGroupId)) {
      return variant;
    }
  }
  return null;
}
 
Example #11
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private boolean maybeSelectNewPrimaryUrl() {
  List<Variant> variants = masterPlaylist.variants;
  int variantsSize = variants.size();
  long currentTimeMs = SystemClock.elapsedRealtime();
  for (int i = 0; i < variantsSize; i++) {
    MediaPlaylistBundle bundle = playlistBundles.get(variants.get(i).url);
    if (currentTimeMs > bundle.blacklistUntilMs) {
      primaryMediaPlaylistUrl = bundle.playlistUrl;
      bundle.loadPlaylist();
      return true;
    }
  }
  return false;
}
 
Example #12
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/** Returns whether any of the variants in the master playlist have the specified playlist URL. */
private boolean isVariantUrl(Uri playlistUrl) {
  List<Variant> variants = masterPlaylist.variants;
  for (int i = 0; i < variants.size(); i++) {
    if (playlistUrl.equals(variants.get(i).url)) {
      return true;
    }
  }
  return false;
}