Java Code Examples for com.google.android.exoplayer2.upstream.DataSpec#FLAG_ALLOW_CACHE_FRAGMENTATION

The following examples show how to use com.google.android.exoplayer2.upstream.DataSpec#FLAG_ALLOW_CACHE_FRAGMENTATION . 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: ProgressiveDownloader.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @param uri Uri of the data to be downloaded.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 * @param constructorHelper A {@link DownloaderConstructorHelper} instance.
 */
public ProgressiveDownloader(
    Uri uri, @Nullable String customCacheKey, DownloaderConstructorHelper constructorHelper) {
  this.dataSpec =
      new DataSpec(
          uri,
          /* absoluteStreamPosition= */ 0,
          C.LENGTH_UNSET,
          customCacheKey,
          /* flags= */ DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION);
  this.cache = constructorHelper.getCache();
  this.dataSource = constructorHelper.createCacheDataSource();
  this.cacheKeyFactory = constructorHelper.getCacheKeyFactory();
  this.priorityTaskManager = constructorHelper.getPriorityTaskManager();
  isCanceled = new AtomicBoolean();
}
 
Example 2
Source File: ProgressiveDownloader.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param uri Uri of the data to be downloaded.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 * @param constructorHelper A {@link DownloaderConstructorHelper} instance.
 */
public ProgressiveDownloader(
    Uri uri, @Nullable String customCacheKey, DownloaderConstructorHelper constructorHelper) {
  this.dataSpec =
      new DataSpec(
          uri,
          /* absoluteStreamPosition= */ 0,
          C.LENGTH_UNSET,
          customCacheKey,
          /* flags= */ DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION);
  this.cache = constructorHelper.getCache();
  this.dataSource = constructorHelper.createCacheDataSource();
  this.cacheKeyFactory = constructorHelper.getCacheKeyFactory();
  this.priorityTaskManager = constructorHelper.getPriorityTaskManager();
  isCanceled = new AtomicBoolean();
}
 
Example 3
Source File: ProgressiveDownloader.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param uri Uri of the data to be downloaded.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 * @param constructorHelper A {@link DownloaderConstructorHelper} instance.
 */
public ProgressiveDownloader(
    Uri uri, @Nullable String customCacheKey, DownloaderConstructorHelper constructorHelper) {
  this.dataSpec =
      new DataSpec(
          uri,
          /* absoluteStreamPosition= */ 0,
          C.LENGTH_UNSET,
          customCacheKey,
          /* flags= */ DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION);
  this.cache = constructorHelper.getCache();
  this.dataSource = constructorHelper.createCacheDataSource();
  this.cacheKeyFactory = constructorHelper.getCacheKeyFactory();
  this.priorityTaskManager = constructorHelper.getPriorityTaskManager();
  isCanceled = new AtomicBoolean();
}
 
Example 4
Source File: ProgressiveMediaPeriod.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private DataSpec buildDataSpec(long position) {
  // Disable caching if the content length cannot be resolved, since this is indicative of a
  // progressive live stream.
  return new DataSpec(
      uri,
      position,
      C.LENGTH_UNSET,
      customCacheKey,
      DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN | DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION,
      ICY_METADATA_HEADERS);
}
 
Example 5
Source File: ProgressiveMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private DataSpec buildDataSpec(long position) {
  // Disable caching if the content length cannot be resolved, since this is indicative of a
  // progressive live stream.
  return new DataSpec(
      uri,
      position,
      C.LENGTH_UNSET,
      customCacheKey,
      DataSpec.FLAG_ALLOW_ICY_METADATA
          | DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN
          | DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION);
}
 
Example 6
Source File: ProgressiveMediaPeriod.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private DataSpec buildDataSpec(long position) {
  // Disable caching if the content length cannot be resolved, since this is indicative of a
  // progressive live stream.
  return new DataSpec(
      uri,
      position,
      C.LENGTH_UNSET,
      customCacheKey,
      DataSpec.FLAG_ALLOW_ICY_METADATA
          | DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN
          | DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION);
}