public final class

DefaultDataSource.Factory

extends java.lang.Object

implements DataSource.Factory

 java.lang.Object

↳androidx.media3.datasource.DefaultDataSource.Factory

Overview

DataSource.Factory for DefaultDataSource instances.

Summary

Constructors
publicFactory(Context context)

Creates an instance.

publicFactory(Context context, DataSource.Factory baseDataSourceFactory)

Creates an instance.

Methods
public DefaultDataSourcecreateDataSource()

public DefaultDataSource.FactorysetTransferListener(TransferListener transferListener)

Sets the TransferListener that will be used.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Factory(Context context)

Creates an instance.

Parameters:

context: A context.

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.

Methods

public DefaultDataSource.Factory setTransferListener(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.

public DefaultDataSource createDataSource()