Package com.google.android.exoplayer2.upstream

## Class DefaultDataSource.Factory

- java.lang.Object
- - com.google.android.exoplayer2.upstream.DefaultDataSource.Factory

- All Implemented Interfaces:
    `DataSource.Factory`
  Enclosing class:
    DefaultDataSource

      public static final class DefaultDataSource.Factory
      extends Object
      implements DataSource.Factory

  `DataSource.Factory` for `DefaultDataSource` instances.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Factory​(Context context)` | Creates an instance.
    `Factory​(Context context, DataSource.Factory baseDataSourceFactory)` | Creates an instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DefaultDataSource` | `createDataSource()` | Creates a `DataSource` instance.
    `DefaultDataSource.Factory` | `setTransferListener​(TransferListener transferListener)` | Sets the `TransferListener` that will be used.

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

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

- - ### Constructor Detail

    - #### Factory

          public Factory​(Context context)

      Creates an instance.
      Parameters:
        `context` - A context.

    - #### Factory

          public Factory​(Context context,
                         DataSource.Factory baseDataSourceFactory)

      Creates an instance.
      Parameters:
        `context` - A context.
        `baseDataSourceFactory` - The `DataSource.Factory` to be used to create base `DataSources` for `DefaultDataSource` instances. The base `DataSource` is normally an `HttpDataSource`, and is responsible for fetching data over HTTP and HTTPS, as well as any other URI schemes not otherwise supported by `DefaultDataSource`.

  - ### Method Detail

    - #### setTransferListener

          @CanIgnoreReturnValue
          public DefaultDataSource.Factory setTransferListener​(@Nullable
                                                               TransferListener transferListener)

      Sets the `TransferListener` that will be used.

      The default is `null`.

      See `DataSource.addTransferListener(TransferListener)`.

      Parameters:
        `transferListener` - The listener that will be used.
      Returns:
        This factory.

    - #### createDataSource

          public DefaultDataSource createDataSource()

      Description copied from interface: `DataSource.Factory`
      Creates a `DataSource` instance.
      Specified by:
        `createDataSource` in interface `DataSource.Factory`