com.google.android.exoplayer2.upstream.Loader.Loadable Java Examples

The following examples show how to use com.google.android.exoplayer2.upstream.Loader.Loadable. 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: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Blacklists resources whose load error was an {@link InvalidResponseCodeException} with
 * response code HTTP 404 or 410. The duration of the blacklisting is {@link
 * ChunkedTrackBlacklistUtil#DEFAULT_TRACK_BLACKLIST_MS}.
 */
@Override
public long getBlacklistDurationMsFor(
    Loadable loadable, long loadDurationMs, IOException exception, int errorCount) {
  if (exception instanceof InvalidResponseCodeException) {
    int responseCode = ((InvalidResponseCodeException) exception).responseCode;
    return responseCode == 404 // HTTP 404 Not Found.
            || responseCode == 410 // HTTP 410 Gone.
        ? ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS
        : C.TIME_UNSET;
  }
  return C.TIME_UNSET;
}
 
Example #2
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retries for any exception that is not a subclass of {@link ParserException}. The retry
 * delay is calculated as {@code Math.min((errorCount - 1) * 1000, 5000)}.
 */
@Override
public long getRetryDelayMsFor(
    Loadable loadable, long loadDurationMs, IOException exception, int errorCount) {
  return exception instanceof ParserException
      ? C.TIME_UNSET
      : Math.min((errorCount - 1) * 1000, 5000);
}
 
Example #3
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Blacklists resources whose load error was an {@link InvalidResponseCodeException} with
 * response code HTTP 404 or 410. The duration of the blacklisting is {@link
 * ChunkedTrackBlacklistUtil#DEFAULT_TRACK_BLACKLIST_MS}.
 */
@Override
public long getBlacklistDurationMsFor(
    Loadable loadable, long loadDurationMs, IOException exception, int errorCount) {
  if (exception instanceof InvalidResponseCodeException) {
    int responseCode = ((InvalidResponseCodeException) exception).responseCode;
    return responseCode == 404 // HTTP 404 Not Found.
            || responseCode == 410 // HTTP 410 Gone.
        ? ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS
        : C.TIME_UNSET;
  }
  return C.TIME_UNSET;
}
 
Example #4
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retries for any exception that is not a subclass of {@link ParserException}. The retry
 * delay is calculated as {@code Math.min((errorCount - 1) * 1000, 5000)}.
 */
@Override
public long getRetryDelayMsFor(
    Loadable loadable, long loadDurationMs, IOException exception, int errorCount) {
  return exception instanceof ParserException
      ? C.TIME_UNSET
      : Math.min((errorCount - 1) * 1000, 5000);
}
 
Example #5
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns {@link #DEFAULT_MIN_LOADABLE_RETRY_COUNT}. */
@Override
public int getMinimumLoadableRetryCount(Loadable loadable) {
  return DEFAULT_MIN_LOADABLE_RETRY_COUNT;
}
 
Example #6
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns {@link #DEFAULT}. */
static <U extends Loadable> LoadErrorHandlingPolicy<U> getDefault() {
  @SuppressWarnings("unchecked") // Safe contravariant cast.
  LoadErrorHandlingPolicy<U> policy = (LoadErrorHandlingPolicy<U>) DEFAULT;
  return policy;
}
 
Example #7
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns {@link #DEFAULT_MIN_LOADABLE_RETRY_COUNT}. */
@Override
public int getMinimumLoadableRetryCount(Loadable loadable) {
  return DEFAULT_MIN_LOADABLE_RETRY_COUNT;
}
 
Example #8
Source File: LoadErrorHandlingPolicy.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns {@link #DEFAULT}. */
static <U extends Loadable> LoadErrorHandlingPolicy<U> getDefault() {
  @SuppressWarnings("unchecked") // Safe contravariant cast.
  LoadErrorHandlingPolicy<U> policy = (LoadErrorHandlingPolicy<U>) DEFAULT;
  return policy;
}