com.google.android.exoplayer2.source.hls.HlsDataSourceFactory Java Examples

The following examples show how to use com.google.android.exoplayer2.source.hls.HlsDataSourceFactory. 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: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory) {
  this(
      dataSourceFactory,
      loadErrorHandlingPolicy,
      playlistParserFactory,
      DEFAULT_PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT);
}
 
Example #2
Source File: DefaultHlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
 * @param playlistStuckTargetDurationCoefficient A coefficient to apply to the target duration of
 *     media playlists in order to determine that a non-changing playlist is stuck. Once a
 *     playlist is deemed stuck, a {@link PlaylistStuckException} is thrown via {@link
 *     #maybeThrowPlaylistRefreshError(Uri)}.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory,
    double playlistStuckTargetDurationCoefficient) {
  this.dataSourceFactory = dataSourceFactory;
  this.playlistParserFactory = playlistParserFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.playlistStuckTargetDurationCoefficient = playlistStuckTargetDurationCoefficient;
  listeners = new ArrayList<>();
  playlistBundles = new HashMap<>();
  initialStartTimeUs = C.TIME_UNSET;
}
 
Example #3
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 #4
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 #5
Source File: HlsPlaylistTracker.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * @param initialPlaylistUri Uri for the initial playlist of the stream. Can refer a media
 *     playlist or a master playlist.
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param minRetryCount The minimum number of times the load must be retried before blacklisting a
 *     playlist.
 * @param primaryPlaylistListener A callback for the primary playlist change events.
 */
public HlsPlaylistTracker(Uri initialPlaylistUri, HlsDataSourceFactory dataSourceFactory,
    EventDispatcher eventDispatcher, int minRetryCount,
    PrimaryPlaylistListener primaryPlaylistListener) {
  this.initialPlaylistUri = initialPlaylistUri;
  this.dataSourceFactory = dataSourceFactory;
  this.eventDispatcher = eventDispatcher;
  this.minRetryCount = minRetryCount;
  this.primaryPlaylistListener = primaryPlaylistListener;
  listeners = new ArrayList<>();
  initialPlaylistLoader = new Loader("HlsPlaylistTracker:MasterPlaylist");
  playlistParser = new HlsPlaylistParser();
  playlistBundles = new IdentityHashMap<>();
  playlistRefreshHandler = new Handler();
}
 
Example #6
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory) {
  this(
      dataSourceFactory,
      loadErrorHandlingPolicy,
      playlistParserFactory,
      DEFAULT_PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT);
}
 
Example #7
Source File: DefaultHlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
 * @param playlistStuckTargetDurationCoefficient A coefficient to apply to the target duration of
 *     media playlists in order to determine that a non-changing playlist is stuck. Once a
 *     playlist is deemed stuck, a {@link PlaylistStuckException} is thrown via {@link
 *     #maybeThrowPlaylistRefreshError(Uri)}.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory,
    double playlistStuckTargetDurationCoefficient) {
  this.dataSourceFactory = dataSourceFactory;
  this.playlistParserFactory = playlistParserFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.playlistStuckTargetDurationCoefficient = playlistStuckTargetDurationCoefficient;
  listeners = new ArrayList<>();
  playlistBundles = new HashMap<>();
  initialStartTimeUs = C.TIME_UNSET;
}
 
Example #8
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory) {
  this(
      dataSourceFactory,
      loadErrorHandlingPolicy,
      playlistParserFactory,
      DEFAULT_PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT);
}
 
Example #9
Source File: DefaultHlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param dataSourceFactory A factory for {@link DataSource} instances.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
 * @param playlistStuckTargetDurationCoefficient A coefficient to apply to the target duration of
 *     media playlists in order to determine that a non-changing playlist is stuck. Once a
 *     playlist is deemed stuck, a {@link PlaylistStuckException} is thrown via {@link
 *     #maybeThrowPlaylistRefreshError(Uri)}.
 */
public DefaultHlsPlaylistTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory,
    double playlistStuckTargetDurationCoefficient) {
  this.dataSourceFactory = dataSourceFactory;
  this.playlistParserFactory = playlistParserFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.playlistStuckTargetDurationCoefficient = playlistStuckTargetDurationCoefficient;
  listeners = new ArrayList<>();
  playlistBundles = new HashMap<>();
  initialStartTimeUs = C.TIME_UNSET;
}
 
Example #10
Source File: HlsPlaylistTracker.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new tracker instance.
 *
 * @param dataSourceFactory The {@link HlsDataSourceFactory} to use for playlist loading.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy} for playlist load errors.
 * @param playlistParserFactory The {@link HlsPlaylistParserFactory} for playlist parsing.
 */
HlsPlaylistTracker createTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory);
 
Example #11
Source File: HlsPlaylistTracker.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new tracker instance.
 *
 * @param dataSourceFactory The {@link HlsDataSourceFactory} to use for playlist loading.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy} for playlist load errors.
 * @param playlistParserFactory The {@link HlsPlaylistParserFactory} for playlist parsing.
 */
HlsPlaylistTracker createTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory);
 
Example #12
Source File: HlsPlaylistTracker.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new tracker instance.
 *
 * @param dataSourceFactory The {@link HlsDataSourceFactory} to use for playlist loading.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy} for playlist load errors.
 * @param playlistParserFactory The {@link HlsPlaylistParserFactory} for playlist parsing.
 */
HlsPlaylistTracker createTracker(
    HlsDataSourceFactory dataSourceFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistParserFactory playlistParserFactory);