Package com.google.android.exoplayer2.ext.ima

## Class ImaServerSideAdInsertionMediaSource.Factory

- java.lang.Object
- - com.google.android.exoplayer2.ext.ima.ImaServerSideAdInsertionMediaSource.Factory

- All Implemented Interfaces:
    `MediaSource.Factory`
  Enclosing class:
    ImaServerSideAdInsertionMediaSource

      public static final class ImaServerSideAdInsertionMediaSource.Factory
      extends Object
      implements MediaSource.Factory

  Factory for creating `ImaServerSideAdInsertionMediaSources`.

  Apps can use the `ImaServerSideAdInsertionMediaSource.Factory` to customized the `DefaultMediaSourceFactory` that is used to build a player:

- - ### Field Summary

    - ### Fields inherited from interface com.google.android.exoplayer2.source.MediaSource.Factory

      `UNSUPPORTED`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Factory​(ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader, MediaSource.Factory contentMediaSourceFactory)` | Creates a new factory for `ImaServerSideAdInsertionMediaSources`.

  - ### Method Summary

    All Methods Instance Methods Concrete 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`.

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

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

- - ### Constructor Detail

    - #### Factory

          public Factory​(ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader,
                         MediaSource.Factory contentMediaSourceFactory)

      Creates a new factory for `ImaServerSideAdInsertionMediaSources`.
      Parameters:
        `adsLoader` - The `ImaServerSideAdInsertionMediaSource.AdsLoader`.
        `contentMediaSourceFactory` - The content media source factory to create content sources.

  - ### Method Detail

    - #### setLoadErrorHandlingPolicy

          @CanIgnoreReturnValue
          public MediaSource.Factory setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy)

      Description copied from interface: `MediaSource.Factory`
      Sets an optional `LoadErrorHandlingPolicy`.
      Specified by:
        `setLoadErrorHandlingPolicy` in interface `MediaSource.Factory`
      Returns:
        This factory, for convenience.

    - #### setDrmSessionManagerProvider

          @CanIgnoreReturnValue
          public MediaSource.Factory setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManagerProvider)

      Description copied from interface: `MediaSource.Factory`
      Sets the `DrmSessionManagerProvider` used to obtain a `DrmSessionManager` for a `MediaItem`.
      Specified by:
        `setDrmSessionManagerProvider` in interface `MediaSource.Factory`
      Returns:
        This factory, for convenience.

    - #### getSupportedTypes

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

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

    - #### createMediaSource

          public MediaSource createMediaSource​(MediaItem mediaItem)

      Description copied from interface: `MediaSource.Factory`
      Creates a new `MediaSource` with the specified `MediaItem`.
      Specified by:
        `createMediaSource` in interface `MediaSource.Factory`
      Parameters:
        `mediaItem` - The media item to play.
      Returns:
        The new `media source`.