com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist Java Examples

The following examples show how to use com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist. 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: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifestUri The {@link Uri} of the HLS manifest.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for manifests,
 *     segments and keys.
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param minLoadableRetryCount The minimum number of times loads must be retried before errors
 *     are propagated.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A {@link MediaSourceEventListener}. May be null if delivery of events is
 *     not required.
 * @param playlistParser A {@link ParsingLoadable.Parser} for HLS playlists.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    int minLoadableRetryCount,
    Handler eventHandler,
    MediaSourceEventListener eventListener,
    ParsingLoadable.Parser<HlsPlaylist> playlistParser) {
  this(
      manifestUri,
      dataSourceFactory,
      extractorFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      LoadErrorHandlingPolicy.getDefault(),
      minLoadableRetryCount,
      new DefaultHlsPlaylistTracker(
          dataSourceFactory,
          LoadErrorHandlingPolicy.getDefault(),
          minLoadableRetryCount,
          playlistParser),
      /* allowChunklessPreparation= */ false,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #2
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifestUri The {@link Uri} of the HLS manifest.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for manifests,
 *     segments and keys.
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param minLoadableRetryCount The minimum number of times loads must be retried before errors
 *     are propagated.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A {@link MediaSourceEventListener}. May be null if delivery of events is
 *     not required.
 * @param playlistParser A {@link ParsingLoadable.Parser} for HLS playlists.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    int minLoadableRetryCount,
    Handler eventHandler,
    MediaSourceEventListener eventListener,
    ParsingLoadable.Parser<HlsPlaylist> playlistParser) {
  this(
      manifestUri,
      dataSourceFactory,
      extractorFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      LoadErrorHandlingPolicy.getDefault(),
      minLoadableRetryCount,
      new DefaultHlsPlaylistTracker(
          dataSourceFactory,
          LoadErrorHandlingPolicy.getDefault(),
          minLoadableRetryCount,
          playlistParser),
      /* allowChunklessPreparation= */ false,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #3
Source File: HlsDownloader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
protected HlsPlaylist getManifest(DataSource dataSource, DataSpec dataSpec) throws IOException {
  return loadManifest(dataSource, dataSpec);
}
 
Example #4
Source File: HlsDownloader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private static HlsPlaylist loadManifest(DataSource dataSource, DataSpec dataSpec)
    throws IOException {
  return ParsingLoadable.load(
      dataSource, new HlsPlaylistParser(), dataSpec, C.DATA_TYPE_MANIFEST);
}
 
Example #5
Source File: HlsDownloader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected HlsPlaylist getManifest(DataSource dataSource, Uri uri) throws IOException {
  return loadManifest(dataSource, uri);
}
 
Example #6
Source File: HlsDownloader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private static HlsPlaylist loadManifest(DataSource dataSource, Uri uri) throws IOException {
  return ParsingLoadable.load(dataSource, new HlsPlaylistParser(), uri, C.DATA_TYPE_MANIFEST);
}
 
Example #7
Source File: HlsDownloadHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns the HLS playlist. Must not be called until after preparation completes. */
public HlsPlaylist getPlaylist() {
  Assertions.checkNotNull(playlist);
  return playlist;
}
 
Example #8
Source File: HlsDownloader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected HlsPlaylist getManifest(DataSource dataSource, Uri uri) throws IOException {
  return loadManifest(dataSource, uri);
}
 
Example #9
Source File: HlsDownloader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private static HlsPlaylist loadManifest(DataSource dataSource, Uri uri) throws IOException {
  return ParsingLoadable.load(dataSource, new HlsPlaylistParser(), uri, C.DATA_TYPE_MANIFEST);
}
 
Example #10
Source File: HlsDownloadHelper.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/** Returns the HLS playlist. Must not be called until after preparation completes. */
public HlsPlaylist getPlaylist() {
  Assertions.checkNotNull(playlist);
  return playlist;
}
 
Example #11
Source File: HlsDownloader.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected HlsPlaylist getManifest(DataSource dataSource, DataSpec dataSpec) throws IOException {
  return loadManifest(dataSource, dataSpec);
}
 
Example #12
Source File: HlsDownloader.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private static HlsPlaylist loadManifest(DataSource dataSource, DataSpec dataSpec)
    throws IOException {
  return ParsingLoadable.load(
      dataSource, new HlsPlaylistParser(), dataSpec, C.DATA_TYPE_MANIFEST);
}
 
Example #13
Source File: HlsDownloader.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected HlsPlaylist getManifest(DataSource dataSource, DataSpec dataSpec) throws IOException {
  return loadManifest(dataSource, dataSpec);
}
 
Example #14
Source File: HlsDownloader.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private static HlsPlaylist loadManifest(DataSource dataSource, DataSpec dataSpec)
    throws IOException {
  return ParsingLoadable.load(
      dataSource, new HlsPlaylistParser(), dataSpec, C.DATA_TYPE_MANIFEST);
}
 
Example #15
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the parser to parse HLS playlists. The default is an instance of {@link
 * HlsPlaylistParser}.
 *
 * <p>Must not be called after calling {@link #setPlaylistTracker} on the same builder.
 *
 * @param playlistParser A {@link ParsingLoadable.Parser} for HLS playlists.
 * @return This factory, for convenience.
 * @throws IllegalStateException If one of the {@code create} methods has already been called.
 */
public Factory setPlaylistParser(ParsingLoadable.Parser<HlsPlaylist> playlistParser) {
  Assertions.checkState(!isCreateCalled);
  Assertions.checkState(playlistTracker == null, "A playlist tracker has already been set.");
  this.playlistParser = Assertions.checkNotNull(playlistParser);
  return this;
}
 
Example #16
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the parser to parse HLS playlists. The default is an instance of {@link
 * HlsPlaylistParser}.
 *
 * <p>Must not be called after calling {@link #setPlaylistTracker} on the same builder.
 *
 * @param playlistParser A {@link ParsingLoadable.Parser} for HLS playlists.
 * @return This factory, for convenience.
 * @throws IllegalStateException If one of the {@code create} methods has already been called.
 */
public Factory setPlaylistParser(ParsingLoadable.Parser<HlsPlaylist> playlistParser) {
  Assertions.checkState(!isCreateCalled);
  Assertions.checkState(playlistTracker == null, "A playlist tracker has already been set.");
  this.playlistParser = Assertions.checkNotNull(playlistParser);
  return this;
}