HttpDataSource.BaseFactory


@UnstableApi
abstract class HttpDataSource.BaseFactory : HttpDataSource.Factory


Base implementation of Factory that sets default request properties.

Summary

Public constructors

Public functions

HttpDataSource!

Creates a DataSource instance.

HttpDataSource.Factory!
@CanIgnoreReturnValue
setDefaultRequestProperties(
    defaultRequestProperties: (Mutable)Map<String!, String!>!
)

Sets the default request headers for HttpDataSource instances created by the factory.

Protected functions

abstract HttpDataSource!
createDataSourceInternal(
    defaultRequestProperties: HttpDataSource.RequestProperties!
)

Called by createDataSource to create a HttpDataSource instance.

Inherited functions

From androidx.media3.datasource.DataSource.Factory
abstract DataSource!

Creates a DataSource instance.

Public constructors

BaseFactory

BaseFactory()

Public functions

createDataSource

fun createDataSource(): HttpDataSource!

Creates a DataSource instance.

setDefaultRequestProperties

@CanIgnoreReturnValue
fun setDefaultRequestProperties(
    defaultRequestProperties: (Mutable)Map<String!, String!>!
): HttpDataSource.Factory!

Sets the default request headers for HttpDataSource instances created by the factory.

The new request properties will be used for future requests made by HttpDataSources created by the factory, including instances that have already been created. Modifying the defaultRequestProperties map after a call to this method will have no effect, and so it's necessary to call this method again each time the request properties need to be updated.

Parameters
defaultRequestProperties: (Mutable)Map<String!, String!>!

The default request properties.

Returns
HttpDataSource.Factory!

This factory.

Protected functions

createDataSourceInternal

protected abstract fun createDataSourceInternal(
    defaultRequestProperties: HttpDataSource.RequestProperties!
): HttpDataSource!

Called by createDataSource to create a HttpDataSource instance.

Parameters
defaultRequestProperties: HttpDataSource.RequestProperties!

The default RequestProperties to be used by the HttpDataSource instance.

Returns
HttpDataSource!

A HttpDataSource instance.