Package com.google.android.exoplayer2.source

## Class ProgressiveMediaSource.Factory

- java.lang.Object
- - com.google.android.exoplayer2.source.ProgressiveMediaSource.Factory

- All Implemented Interfaces:
    `MediaSourceFactory`
  Enclosing class:
    ProgressiveMediaSource

      public static final class ProgressiveMediaSource.Factory
      extends Object
      implements MediaSourceFactory

  Factory for `ProgressiveMediaSource`s.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Factory​(DataSource.Factory dataSourceFactory)` | Creates a new factory for `ProgressiveMediaSource`s, using the extractors provided by `DefaultExtractorsFactory`.
    `Factory​(DataSource.Factory dataSourceFactory, ExtractorsFactory extractorsFactory)` | Equivalent to `new Factory(dataSourceFactory, () -> new BundledExtractorsAdapter(extractorsFactory)`.
    `Factory​(DataSource.Factory dataSourceFactory, ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory)` | Creates a new factory for `ProgressiveMediaSource`s.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ProgressiveMediaSource` | `createMediaSource​(Uri uri)` | Deprecated. Use `createMediaSource(MediaItem)` instead.
    `ProgressiveMediaSource` | `createMediaSource​(MediaItem mediaItem)` | Returns a new `ProgressiveMediaSource` using the current parameters.
    `int[]` | `getSupportedTypes()` | Returns the `content types` supported by media sources created by this factory.
    `ProgressiveMediaSource.Factory` | `setContinueLoadingCheckIntervalBytes​(int continueLoadingCheckIntervalBytes)` | Sets the number of bytes that should be loaded between each invocation of `SequenceableLoader.Callback.onContinueLoadingRequested(SequenceableLoader)`.
    `ProgressiveMediaSource.Factory` | `setCustomCacheKey​(String customCacheKey)` | Deprecated. Use `MediaItem.Builder.setCustomCacheKey(String)` and `createMediaSource(MediaItem)` instead.
    `ProgressiveMediaSource.Factory` | `setDrmHttpDataSourceFactory​(HttpDataSource.Factory drmHttpDataSourceFactory)` | Sets the `HttpDataSource.Factory` to be used for creating `HttpMediaDrmCallbacks` to execute key and provisioning requests over HTTP.
    `ProgressiveMediaSource.Factory` | `setDrmSessionManager​(DrmSessionManager drmSessionManager)` | Sets the `DrmSessionManager` to use for all media items regardless of their `MediaItem.DrmConfiguration`.
    `ProgressiveMediaSource.Factory` | `setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManagerProvider)` | Sets the `DrmSessionManagerProvider` used to obtain a `DrmSessionManager` for a `MediaItem`.
    `ProgressiveMediaSource.Factory` | `setDrmUserAgent​(String userAgent)` | Sets the optional user agent to be used for DRM requests.
    `ProgressiveMediaSource.Factory` | `setExtractorsFactory​(ExtractorsFactory extractorsFactory)` | Deprecated. Pass the `ExtractorsFactory` via `Factory(DataSource.Factory, ExtractorsFactory)`.
    `ProgressiveMediaSource.Factory` | `setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy)` | Sets the `LoadErrorHandlingPolicy`.
    `ProgressiveMediaSource.Factory` | `setTag​(Object tag)` | Deprecated. Use `MediaItem.Builder.setTag(Object)` and `createMediaSource(MediaItem)` instead.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.android.exoplayer2.source.MediaSourceFactory

      `setStreamKeys`

- - ### Constructor Detail

    - #### Factory

          public Factory​(DataSource.Factory dataSourceFactory)

      Creates a new factory for `ProgressiveMediaSource`s, using the extractors provided by `DefaultExtractorsFactory`.
      Parameters:
        `dataSourceFactory` - A factory for `DataSource`s to read the media.

    - #### Factory

          public Factory​(DataSource.Factory dataSourceFactory,
                         ExtractorsFactory extractorsFactory)

      Equivalent to `new Factory(dataSourceFactory, () -> new BundledExtractorsAdapter(extractorsFactory)`.

    - #### Factory

          public Factory​(DataSource.Factory dataSourceFactory,
                         ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory)

      Creates a new factory for `ProgressiveMediaSource`s.
      Parameters:
        `dataSourceFactory` - A factory for `DataSource`s to read the media.
        `progressiveMediaExtractorFactory` - A factory for the `ProgressiveMediaExtractor` to extract media from its container.

  - ### Method Detail

    - #### setExtractorsFactory

          @Deprecated
          public ProgressiveMediaSource.Factory setExtractorsFactory​(@Nullable
                                                                     ExtractorsFactory extractorsFactory)

      Deprecated.
      Pass the `ExtractorsFactory` via `Factory(DataSource.Factory, ExtractorsFactory)`. This is necessary so that proguard can treat the default extractors factory as unused.

    - #### setCustomCacheKey

          @Deprecated
          public ProgressiveMediaSource.Factory setCustomCacheKey​(@Nullable
                                                                  String customCacheKey)

      Deprecated.
      Use `MediaItem.Builder.setCustomCacheKey(String)` and `createMediaSource(MediaItem)` instead.

    - #### setTag

          @Deprecated
          public ProgressiveMediaSource.Factory setTag​(@Nullable
                                                       Object tag)

      Deprecated.
      Use `MediaItem.Builder.setTag(Object)` and `createMediaSource(MediaItem)` instead.

    - #### setLoadErrorHandlingPolicy

          public ProgressiveMediaSource.Factory setLoadErrorHandlingPolicy​(@Nullable
                                                                           LoadErrorHandlingPolicy loadErrorHandlingPolicy)

      Sets the `LoadErrorHandlingPolicy`. The default value is created by calling `DefaultLoadErrorHandlingPolicy()`.
      Specified by:
        `setLoadErrorHandlingPolicy` in interface `MediaSourceFactory`
      Parameters:
        `loadErrorHandlingPolicy` - A `LoadErrorHandlingPolicy`.
      Returns:
        This factory, for convenience.

    - #### setContinueLoadingCheckIntervalBytes

          public ProgressiveMediaSource.Factory setContinueLoadingCheckIntervalBytes​(int continueLoadingCheckIntervalBytes)

      Sets the number of bytes that should be loaded between each invocation of `SequenceableLoader.Callback.onContinueLoadingRequested(SequenceableLoader)`. The default value is `ProgressiveMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES`.
      Parameters:
        `continueLoadingCheckIntervalBytes` - The number of bytes that should be loaded between each invocation of `SequenceableLoader.Callback.onContinueLoadingRequested(SequenceableLoader)`.
      Returns:
        This factory, for convenience.

    - #### setDrmSessionManagerProvider

          public ProgressiveMediaSource.Factory setDrmSessionManagerProvider​(@Nullable
                                                                             DrmSessionManagerProvider drmSessionManagerProvider)

      Description copied from interface: `MediaSourceFactory`
      Sets the `DrmSessionManagerProvider` used to obtain a `DrmSessionManager` for a `MediaItem`.

      If not set, `DefaultDrmSessionManagerProvider` is used.

      If set, calls to the following (deprecated) methods are ignored:

      - `MediaSourceFactory.setDrmUserAgent(String)`
      - `MediaSourceFactory.setDrmHttpDataSourceFactory(HttpDataSource.Factory)`
      Specified by:
        `setDrmSessionManagerProvider` in interface `MediaSourceFactory`
      Returns:
        This factory, for convenience.

    - #### setDrmSessionManager

          public ProgressiveMediaSource.Factory setDrmSessionManager​(@Nullable
                                                                     DrmSessionManager drmSessionManager)

      Description copied from interface: `MediaSourceFactory`
      Sets the `DrmSessionManager` to use for all media items regardless of their `MediaItem.DrmConfiguration`.

      Calling this with a non-null `drmSessionManager` is equivalent to calling `setDrmSessionManagerProvider(unusedMediaItem -> drmSessionManager)`.

      Specified by:
        `setDrmSessionManager` in interface `MediaSourceFactory`
      Parameters:
        `drmSessionManager` - The `DrmSessionManager`, or `null` to use the `DefaultDrmSessionManager`.
      Returns:
        This factory, for convenience.

    - #### setDrmHttpDataSourceFactory

          public ProgressiveMediaSource.Factory setDrmHttpDataSourceFactory​(@Nullable
                                                                            HttpDataSource.Factory drmHttpDataSourceFactory)

      Description copied from interface: `MediaSourceFactory`
      Sets the `HttpDataSource.Factory` to be used for creating `HttpMediaDrmCallbacks` to execute key and provisioning requests over HTTP.

      Calls to this method are ignored if either a `DrmSessionManager provider` or `concrete DrmSessionManager` are provided.

      Specified by:
        `setDrmHttpDataSourceFactory` in interface `MediaSourceFactory`
      Parameters:
        `drmHttpDataSourceFactory` - The HTTP data source factory, or `null` to use `DefaultHttpDataSourceFactory`.
      Returns:
        This factory, for convenience.

    - #### setDrmUserAgent

          public ProgressiveMediaSource.Factory setDrmUserAgent​(@Nullable
                                                                String userAgent)

      Description copied from interface: `MediaSourceFactory`
      Sets the optional user agent to be used for DRM requests.

      Calls to this method are ignored if any of the following are provided:

      - A `DrmSessionManager provider`.
      - A `concrete DrmSessionManager`.
      - A `DRM HttpDataSource.Factory`.
      Specified by:
        `setDrmUserAgent` in interface `MediaSourceFactory`
      Parameters:
        `userAgent` - The user agent to be used for DRM requests, or `null` to use the default.
      Returns:
        This factory, for convenience.

    - #### createMediaSource

          @Deprecated
          public ProgressiveMediaSource createMediaSource​(Uri uri)

      Deprecated.
      Use `createMediaSource(MediaItem)` instead.
      Specified by:
        `createMediaSource` in interface `MediaSourceFactory`

    - #### createMediaSource

          public ProgressiveMediaSource createMediaSource​(MediaItem mediaItem)

      Returns a new `ProgressiveMediaSource` using the current parameters.
      Specified by:
        `createMediaSource` in interface `MediaSourceFactory`
      Parameters:
        `mediaItem` - The `MediaItem`.
      Returns:
        The new `ProgressiveMediaSource`.
      Throws:
        `NullPointerException` - if `MediaItem.playbackProperties` is `null`.

    - #### getSupportedTypes

          public int[] getSupportedTypes()

      Description copied from interface: `MediaSourceFactory`
      Returns the `content types` supported by media sources created by this factory.
      Specified by:
        `getSupportedTypes` in interface `MediaSourceFactory`