com.google.android.exoplayer2.upstream.ParsingLoadable Java Examples

The following examples show how to use com.google.android.exoplayer2.upstream.ParsingLoadable. 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: SsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<SsManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  long retryDelayMs =
      loadErrorHandlingPolicy.getRetryDelayMsFor(
          C.DATA_TYPE_MANIFEST, loadDurationMs, error, errorCount);
  LoadErrorAction loadErrorAction =
      retryDelayMs == C.TIME_UNSET
          ? Loader.DONT_RETRY_FATAL
          : Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs);
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      !loadErrorAction.isRetry());
  return loadErrorAction;
}
 
Example #2
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
LoadErrorAction onUtcTimestampLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      true);
  onUtcTimestampResolutionError(error);
  return Loader.DONT_RETRY;
}
 
Example #3
Source File: HlsPlaylistTracker.java    From K-Sonic with MIT License 6 votes vote down vote up
@Override
public int onLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs,
    long loadDurationMs, IOException error) {
  boolean isFatal = error instanceof ParserException;
  eventDispatcher.loadError(loadable.dataSpec, C.DATA_TYPE_MANIFEST, elapsedRealtimeMs,
      loadDurationMs, loadable.bytesLoaded(), error, isFatal);
  if (isFatal) {
    return Loader.DONT_RETRY_FATAL;
  }
  boolean shouldRetry = true;
  if (ChunkedTrackBlacklistUtil.shouldBlacklist(error)) {
    blacklistUntilMs =
        SystemClock.elapsedRealtime() + ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS;
    notifyPlaylistBlacklisting(playlistUrl,
        ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS);
    shouldRetry = primaryHlsUrl == playlistUrl && !maybeSelectNewPrimaryUrl();
  }
  return shouldRetry ? Loader.RETRY : Loader.DONT_RETRY;
}
 
Example #4
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<SsManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  boolean isFatal = error instanceof ParserException;
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      isFatal);
  return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY;
}
 
Example #5
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<HlsPlaylist> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  long retryDelayMs =
      playlistLoadErrorHandlingPolicy.getRetryDelayMsFor(
          loadable, loadDurationMs, error, errorCount);
  boolean isFatal = retryDelayMs == C.TIME_UNSET;
  eventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      C.DATA_TYPE_MANIFEST,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      isFatal);
  return isFatal
      ? Loader.DONT_RETRY_FATAL
      : Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs);
}
 
Example #6
Source File: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<HlsPlaylist> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  long retryDelayMs =
      loadErrorHandlingPolicy.getRetryDelayMsFor(
          loadable.type, loadDurationMs, error, errorCount);
  boolean isFatal = retryDelayMs == C.TIME_UNSET;
  eventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      C.DATA_TYPE_MANIFEST,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      isFatal);
  return isFatal
      ? Loader.DONT_RETRY_FATAL
      : Loader.createRetryAction(/* resetErrorCount= */ false, retryDelayMs);
}
 
Example #7
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
LoadErrorAction onManifestLoadError(
    ParsingLoadable<DashManifest> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  boolean isFatal = error instanceof ParserException;
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      isFatal);
  return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY;
}
 
Example #8
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
LoadErrorAction onUtcTimestampLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      true);
  onUtcTimestampResolutionError(error);
  return Loader.DONT_RETRY;
}
 
Example #9
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs an instance to play the manifest at a given {@link Uri}, which may be live or
 * on-demand.
 *
 * @param manifestUri The manifest {@link Uri}.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest.
 * @param manifestParser A parser for loaded manifest data.
 * @param chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the
 *     default start position should precede the end of the live window.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public SsMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      livePresentationDelayMs,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #10
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private SsMediaSource(
    SsManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    @Nullable Object tag) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null : SsUtil.fixManifestUri(manifestUri);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  this.tag = tag;
  sideloadedManifest = manifest != null;
  mediaPeriods = new ArrayList<>();
}
 
Example #11
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
LoadErrorAction onUtcTimestampLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      true);
  onUtcTimestampResolutionError(error);
  return Loader.DONT_RETRY;
}
 
Example #12
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs an instance to play the manifest at a given {@link Uri}, which may be live or
 * on-demand.
 *
 * @param manifestUri The manifest {@link Uri}.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest.
 * @param manifestParser A parser for loaded manifest data.
 * @param chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the
 *     default start position should precede the end of the live window.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public SsMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      livePresentationDelayMs,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #13
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
LoadErrorAction onUtcTimestampLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error) {
  manifestEventDispatcher.loadError(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded(),
      error,
      true);
  onUtcTimestampResolutionError(error);
  return Loader.DONT_RETRY;
}
 
Example #14
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void startLoadingManifest() {
  handler.removeCallbacks(refreshManifestRunnable);
  if (loader.isLoading()) {
    manifestLoadPending = true;
    return;
  }
  Uri manifestUri;
  synchronized (manifestUriLock) {
    manifestUri = this.manifestUri;
  }
  manifestLoadPending = false;
  startLoading(
      new ParsingLoadable<>(dataSource, manifestUri, C.DATA_TYPE_MANIFEST, manifestParser),
      manifestCallback,
      minLoadableRetryCount);
}
 
Example #15
Source File: DashMediaSource.java    From K-Sonic with MIT License 5 votes vote down vote up
private void startLoadingManifest() {
  Uri manifestUri;
  synchronized (manifestUriLock) {
    manifestUri = this.manifestUri;
  }
  startLoading(new ParsingLoadable<>(dataSource, manifestUri, C.DATA_TYPE_MANIFEST,
      manifestParser), manifestCallback, minLoadableRetryCount);
}
 
Example #16
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public MediaPlaylistBundle(HlsUrl playlistUrl) {
  this.playlistUrl = playlistUrl;
  mediaPlaylistLoader = new Loader("DefaultHlsPlaylistTracker:MediaPlaylist");
  mediaPlaylistLoadable =
      new ParsingLoadable<>(
          dataSourceFactory.createDataSource(C.DATA_TYPE_MANIFEST),
          UriUtil.resolveToUri(masterPlaylist.baseUri, playlistUrl.url),
          C.DATA_TYPE_MANIFEST,
          playlistParser);
}
 
Example #17
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onLoadCanceled(
    ParsingLoadable<HlsPlaylist> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    boolean released) {
  eventDispatcher.loadCanceled(
      loadable.dataSpec,
      loadable.getUri(),
      C.DATA_TYPE_MANIFEST,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded());
}
 
Example #18
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public MediaPlaylistBundle(Uri playlistUrl) {
  this.playlistUrl = playlistUrl;
  mediaPlaylistLoader = new Loader("DefaultHlsPlaylistTracker:MediaPlaylist");
  mediaPlaylistLoadable =
      new ParsingLoadable<>(
          dataSourceFactory.createDataSource(C.DATA_TYPE_MANIFEST),
          playlistUrl,
          C.DATA_TYPE_MANIFEST,
          mediaPlaylistParser);
}
 
Example #19
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void startLoadingManifest() {
  if (manifestLoader.hasFatalError()) {
    return;
  }
  ParsingLoadable<SsManifest> loadable = new ParsingLoadable<>(manifestDataSource,
      manifestUri, C.DATA_TYPE_MANIFEST, manifestParser);
  long elapsedRealtimeMs =
      manifestLoader.startLoading(
          loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type));
  manifestEventDispatcher.loadStarted(loadable.dataSpec, loadable.type, elapsedRealtimeMs);
}
 
Example #20
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onLoadCompleted(ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs,
    long loadDurationMs) {
  manifestEventDispatcher.loadCompleted(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded());
  manifest = loadable.getResult();
  manifestLoadStartTimestamp = elapsedRealtimeMs - loadDurationMs;
  processManifest();
  scheduleManifestRefresh();
}
 
Example #21
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void startLoadingManifest() {
  if (manifestLoader.hasFatalError()) {
    return;
  }
  ParsingLoadable<SsManifest> loadable = new ParsingLoadable<>(manifestDataSource,
      manifestUri, C.DATA_TYPE_MANIFEST, manifestParser);
  long elapsedRealtimeMs =
      manifestLoader.startLoading(
          loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type));
  manifestEventDispatcher.loadStarted(loadable.dataSpec, loadable.type, elapsedRealtimeMs);
}
 
Example #22
Source File: DefaultHlsPlaylistTracker.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param playlistLoadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy} for playlist loads.
 * @param minRetryCount The minimum number of times loads must be retried before {@link
 *     #maybeThrowPlaylistRefreshError(HlsUrl)} and {@link
 *     #maybeThrowPrimaryPlaylistRefreshError()} propagate any loading errors.
 * @param playlistParser A {@link ParsingLoadable.Parser} for HLS playlists.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy<ParsingLoadable<HlsPlaylist>> playlistLoadErrorHandlingPolicy,
    int minRetryCount,
    ParsingLoadable.Parser<HlsPlaylist> playlistParser) {
  this.dataSourceFactory = dataSourceFactory;
  this.minRetryCount = minRetryCount;
  this.playlistParser = playlistParser;
  this.playlistLoadErrorHandlingPolicy = playlistLoadErrorHandlingPolicy;
  listeners = new ArrayList<>();
  playlistBundles = new IdentityHashMap<>();
  initialStartTimeUs = C.TIME_UNSET;
}
 
Example #23
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
void onLoadCanceled(ParsingLoadable<?> loadable, long elapsedRealtimeMs,
    long loadDurationMs) {
  manifestEventDispatcher.loadCanceled(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.type,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded());
}
 
Example #24
Source File: SsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void startLoadingManifest() {
  if (manifestLoader.hasFatalError()) {
    return;
  }
  ParsingLoadable<SsManifest> loadable = new ParsingLoadable<>(manifestDataSource,
      manifestUri, C.DATA_TYPE_MANIFEST, manifestParser);
  long elapsedRealtimeMs =
      manifestLoader.startLoading(
          loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type));
  manifestEventDispatcher.loadStarted(loadable.dataSpec, loadable.type, elapsedRealtimeMs);
}
 
Example #25
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoadErrorAction onLoadError(
    ParsingLoadable<Long> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    IOException error,
    int errorCount) {
  return onUtcTimestampLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error);
}
 
Example #26
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onLoadCanceled(
    ParsingLoadable<HlsPlaylist> loadable,
    long elapsedRealtimeMs,
    long loadDurationMs,
    boolean released) {
  eventDispatcher.loadCanceled(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      C.DATA_TYPE_MANIFEST,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded());
}
 
Example #27
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onLoadCompleted(
    ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs) {
  HlsPlaylist result = loadable.getResult();
  HlsMasterPlaylist masterPlaylist;
  boolean isMediaPlaylist = result instanceof HlsMediaPlaylist;
  if (isMediaPlaylist) {
    masterPlaylist = HlsMasterPlaylist.createSingleVariantMasterPlaylist(result.baseUri);
  } else /* result instanceof HlsMasterPlaylist */ {
    masterPlaylist = (HlsMasterPlaylist) result;
  }
  this.masterPlaylist = masterPlaylist;
  mediaPlaylistParser = playlistParserFactory.createPlaylistParser(masterPlaylist);
  primaryMediaPlaylistUrl = masterPlaylist.variants.get(0).url;
  createBundles(masterPlaylist.mediaPlaylistUrls);
  MediaPlaylistBundle primaryBundle = playlistBundles.get(primaryMediaPlaylistUrl);
  if (isMediaPlaylist) {
    // We don't need to load the playlist again. We can use the same result.
    primaryBundle.processLoadedPlaylist((HlsMediaPlaylist) result, loadDurationMs);
  } else {
    primaryBundle.loadPlaylist();
  }
  eventDispatcher.loadCompleted(
      loadable.dataSpec,
      loadable.getUri(),
      loadable.getResponseHeaders(),
      C.DATA_TYPE_MANIFEST,
      elapsedRealtimeMs,
      loadDurationMs,
      loadable.bytesLoaded());
}
 
Example #28
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public MediaPlaylistBundle(Uri playlistUrl) {
  this.playlistUrl = playlistUrl;
  mediaPlaylistLoader = new Loader("DefaultHlsPlaylistTracker:MediaPlaylist");
  mediaPlaylistLoadable =
      new ParsingLoadable<>(
          dataSourceFactory.createDataSource(C.DATA_TYPE_MANIFEST),
          playlistUrl,
          C.DATA_TYPE_MANIFEST,
          mediaPlaylistParser);
}
 
Example #29
Source File: HlsPlaylistTracker.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * Starts tracking all the playlists related to the provided Uri.
 */
public void start() {
  ParsingLoadable<HlsPlaylist> masterPlaylistLoadable = new ParsingLoadable<>(
      dataSourceFactory.createDataSource(C.DATA_TYPE_MANIFEST), initialPlaylistUri,
      C.DATA_TYPE_MANIFEST, playlistParser);
  initialPlaylistLoader.startLoading(masterPlaylistLoadable, this, minRetryCount);
}
 
Example #30
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an instance to play the manifest at a given {@link Uri}, which may be dynamic or
 * static.
 *
 * @param manifestUri The manifest {@link Uri}.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest.
 * @param manifestParser A parser for loaded manifest data.
 * @param chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the
 *     default start position should precede the end of the live window. Use {@link
 *     #DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS} to use the value specified by the
 *     manifest, if present.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
@SuppressWarnings("deprecation")
public DashMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      livePresentationDelayMs == DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
          ? DEFAULT_LIVE_PRESENTATION_DELAY_MS
          : livePresentationDelayMs,
      livePresentationDelayMs != DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}