Package com.google.android.exoplayer2.source.smoothstreaming

## Class SsMediaSource.Factory

- java.lang.Object
- - com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource.Factory

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

      public static final class SsMediaSource.Factory
      extends Object
      implements MediaSourceFactory

  Factory for `SsMediaSource`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Factory​(SsChunkSource.Factory chunkSourceFactory, DataSource.Factory manifestDataSourceFactory)` | Creates a new factory for `SsMediaSource`s.
    `Factory​(DataSource.Factory dataSourceFactory)` | Creates a new factory for `SsMediaSource`s.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SsMediaSource` | `createMediaSource​(Uri uri)` | Deprecated. Use `createMediaSource(MediaItem)` instead.
    `SsMediaSource` | `createMediaSource​(MediaItem mediaItem)` | Returns a new `SsMediaSource` using the current parameters.
    `SsMediaSource` | `createMediaSource​(SsManifest manifest)` | Returns a new `SsMediaSource` using the current parameters and the specified sideloaded manifest.
    `SsMediaSource` | `createMediaSource​(SsManifest manifest, MediaItem mediaItem)` | Returns a new `SsMediaSource` using the current parameters and the specified sideloaded manifest.
    `int[]` | `getSupportedTypes()` | Returns the `content types` supported by media sources created by this factory.
    `SsMediaSource.Factory` | `setCompositeSequenceableLoaderFactory​(CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)` | Sets the factory to create composite `SequenceableLoader`s for when this media source loads data from multiple streams (video, audio etc.).
    `SsMediaSource.Factory` | `setDrmHttpDataSourceFactory​(HttpDataSource.Factory drmHttpDataSourceFactory)` | Sets the `HttpDataSource.Factory` to be used for creating `HttpMediaDrmCallbacks` to execute key and provisioning requests over HTTP.
    `SsMediaSource.Factory` | `setDrmSessionManager​(DrmSessionManager drmSessionManager)` | Sets the `DrmSessionManager` to use for all media items regardless of their `MediaItem.DrmConfiguration`.
    `SsMediaSource.Factory` | `setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManagerProvider)` | Sets the `DrmSessionManagerProvider` used to obtain a `DrmSessionManager` for a `MediaItem`.
    `SsMediaSource.Factory` | `setDrmUserAgent​(String userAgent)` | Sets the optional user agent to be used for DRM requests.
    `SsMediaSource.Factory` | `setLivePresentationDelayMs​(long livePresentationDelayMs)` | Sets the duration in milliseconds by which the default start position should precede the end of the live window for live playbacks.
    `SsMediaSource.Factory` | `setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy)` | Sets the `LoadErrorHandlingPolicy`.
    `SsMediaSource.Factory` | `setManifestParser​(ParsingLoadable.Parser<? extends SsManifest> manifestParser)` | Sets the manifest parser to parse loaded manifest data when loading a manifest URI.
    `SsMediaSource.Factory` | `setStreamKeys​(List<StreamKey> streamKeys)` | Deprecated. Use `MediaItem.Builder.setStreamKeys(List)` and `createMediaSource(MediaItem)` instead.
    `SsMediaSource.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`

- - ### Constructor Detail

    - #### Factory

          public Factory​(DataSource.Factory dataSourceFactory)

      Creates a new factory for `SsMediaSource`s.
      Parameters:
        `dataSourceFactory` - A factory for `DataSource` instances that will be used to load manifest and media data.

    - #### Factory

          public Factory​(SsChunkSource.Factory chunkSourceFactory,
                         @Nullable
                         DataSource.Factory manifestDataSourceFactory)

      Creates a new factory for `SsMediaSource`s.
      Parameters:
        `chunkSourceFactory` - A factory for `SsChunkSource` instances.
        `manifestDataSourceFactory` - A factory for `DataSource` instances that will be used to load (and refresh) the manifest. May be `null` if the factory will only ever be used to create create media sources with sideloaded manifests via `createMediaSource(SsManifest, MediaItem)`.

  - ### Method Detail

    - #### setTag

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

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

    - #### setLoadErrorHandlingPolicy

          public SsMediaSource.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.

    - #### setLivePresentationDelayMs

          public SsMediaSource.Factory setLivePresentationDelayMs​(long livePresentationDelayMs)

      Sets the duration in milliseconds by which the default start position should precede the end of the live window for live playbacks. The default value is `SsMediaSource.DEFAULT_LIVE_PRESENTATION_DELAY_MS`.
      Parameters:
        `livePresentationDelayMs` - For live playbacks, the duration in milliseconds by which the default start position should precede the end of the live window.
      Returns:
        This factory, for convenience.

    - #### setManifestParser

          public SsMediaSource.Factory setManifestParser​(@Nullable
                                                         ParsingLoadable.Parser<? extends SsManifest> manifestParser)

      Sets the manifest parser to parse loaded manifest data when loading a manifest URI.
      Parameters:
        `manifestParser` - A parser for loaded manifest data.
      Returns:
        This factory, for convenience.

    - #### setCompositeSequenceableLoaderFactory

          public SsMediaSource.Factory setCompositeSequenceableLoaderFactory​(@Nullable
                                                                             CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory)

      Sets the factory to create composite `SequenceableLoader`s for when this media source loads data from multiple streams (video, audio etc.). The default is an instance of `DefaultCompositeSequenceableLoaderFactory`.
      Parameters:
        `compositeSequenceableLoaderFactory` - A factory to create composite `SequenceableLoader`s for when this media source loads data from multiple streams (video, audio etc.).
      Returns:
        This factory, for convenience.

    - #### setDrmSessionManagerProvider

          public SsMediaSource.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 SsMediaSource.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 SsMediaSource.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 SsMediaSource.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.

    - #### setStreamKeys

          @Deprecated
          public SsMediaSource.Factory setStreamKeys​(@Nullable
                                                     List<StreamKey> streamKeys)

      Deprecated.
      Use `MediaItem.Builder.setStreamKeys(List)` and `createMediaSource(MediaItem)` instead.
      Specified by:
        `setStreamKeys` in interface `MediaSourceFactory`

    - #### createMediaSource

          @Deprecated
          public SsMediaSource createMediaSource​(Uri uri)

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

    - #### createMediaSource

          public SsMediaSource createMediaSource​(SsManifest manifest)

      Returns a new `SsMediaSource` using the current parameters and the specified sideloaded manifest.
      Parameters:
        `manifest` - The manifest. `SsManifest.isLive` must be false.
      Returns:
        The new `SsMediaSource`.
      Throws:
        `IllegalArgumentException` - If `SsManifest.isLive` is true.

    - #### createMediaSource

          public SsMediaSource createMediaSource​(SsManifest manifest,
                                                 MediaItem mediaItem)

      Returns a new `SsMediaSource` using the current parameters and the specified sideloaded manifest.
      Parameters:
        `manifest` - The manifest. `SsManifest.isLive` must be false.
        `mediaItem` - The `MediaItem` to be included in the timeline.
      Returns:
        The new `SsMediaSource`.
      Throws:
        `IllegalArgumentException` - If `SsManifest.isLive` is true.

    - #### createMediaSource

          public SsMediaSource createMediaSource​(MediaItem mediaItem)

      Returns a new `SsMediaSource` using the current parameters.
      Specified by:
        `createMediaSource` in interface `MediaSourceFactory`
      Parameters:
        `mediaItem` - The `MediaItem`.
      Returns:
        The new `SsMediaSource`.
      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`