Package com.google.android.exoplayer2.source

## Interface MediaSource.Factory

- All Known Subinterfaces:
    `MediaSourceFactory`
  All Known Implementing Classes:
    `DashMediaSource.Factory`, `DefaultMediaSourceFactory`, `FakeMediaSourceFactory`, `HlsMediaSource.Factory`, `ImaServerSideAdInsertionMediaSource.Factory`, `ProgressiveMediaSource.Factory`, `RtspMediaSource.Factory`, `SsMediaSource.Factory`
  Enclosing interface:
    MediaSource

      public static interface MediaSource.Factory

  Factory for creating `MediaSources` from `MediaItems`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static MediaSource.Factory` | `UNSUPPORTED` | An instance that throws `UnsupportedOperationException` from `createMediaSource(com.google.android.exoplayer2.MediaItem)` and `getSupportedTypes()`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MediaSource` | `createMediaSource​(MediaItem mediaItem)` | Creates a new `MediaSource` with the specified `MediaItem`.
    `@com.google.android.exoplayer2.C.ContentType int[]` | `getSupportedTypes()` | Returns the `content types` supported by media sources created by this factory.
    `MediaSource.Factory` | `setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManagerProvider)` | Sets the `DrmSessionManagerProvider` used to obtain a `DrmSessionManager` for a `MediaItem`.
    `MediaSource.Factory` | `setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy)` | Sets an optional `LoadErrorHandlingPolicy`.

- - ### Field Detail

    - #### UNSUPPORTED

          static final MediaSource.Factory UNSUPPORTED

      An instance that throws `UnsupportedOperationException` from `createMediaSource(com.google.android.exoplayer2.MediaItem)` and `getSupportedTypes()`.

  - ### Method Detail

    - #### setDrmSessionManagerProvider

          MediaSource.Factory setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManagerProvider)

      Sets the `DrmSessionManagerProvider` used to obtain a `DrmSessionManager` for a `MediaItem`.
      Returns:
        This factory, for convenience.

    - #### setLoadErrorHandlingPolicy

          MediaSource.Factory setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy)

      Sets an optional `LoadErrorHandlingPolicy`.
      Returns:
        This factory, for convenience.

    - #### getSupportedTypes

          @ContentType
          @com.google.android.exoplayer2.C.ContentType int[] getSupportedTypes()

      Returns the `content types` supported by media sources created by this factory.

    - #### createMediaSource

          MediaSource createMediaSource​(MediaItem mediaItem)

      Creates a new `MediaSource` with the specified `MediaItem`.
      Parameters:
        `mediaItem` - The media item to play.
      Returns:
        The new `media source`.