CronetDataSourceFactory


@UnstableApi
class CronetDataSourceFactory : HttpDataSource.BaseFactory


Summary

Constants

const Int

The default connection timeout, in milliseconds.

const Int

The default read timeout, in milliseconds.

Public constructors

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    userAgent: String?
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    userAgent: String?
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    userAgent: String?
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    userAgent: String?
)

Creates an instance.

Protected functions

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.

From androidx.media3.datasource.HttpDataSource.BaseFactory
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.

Constants

DEFAULT_CONNECT_TIMEOUT_MILLIS

const val DEFAULT_CONNECT_TIMEOUT_MILLIS = 8000: Int

The default connection timeout, in milliseconds.

DEFAULT_READ_TIMEOUT_MILLIS

const val DEFAULT_READ_TIMEOUT_MILLIS = 8000: Int

The default read timeout, in milliseconds.

Public constructors

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, a will be used instead.

Sets DEFAULT_CONNECT_TIMEOUT_MILLIS as the connection timeout, DEFAULT_READ_TIMEOUT_MILLIS as the read timeout.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, the provided fallback HttpDataSource.Factory will be used instead.

Sets DEFAULT_CONNECT_TIMEOUT_MILLIS as the connection timeout, DEFAULT_READ_TIMEOUT_MILLIS as the read timeout.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

fallbackFactory: HttpDataSource.Factory!

A HttpDataSource.Factory which is used as a fallback in case no suitable CronetEngine can be build.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, a will be used instead.

Sets DEFAULT_CONNECT_TIMEOUT_MILLIS as the connection timeout, DEFAULT_READ_TIMEOUT_MILLIS as the read timeout.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

transferListener: TransferListener?

An optional listener.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    userAgent: String?
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, a will be used instead.

Sets DEFAULT_CONNECT_TIMEOUT_MILLIS as the connection timeout, DEFAULT_READ_TIMEOUT_MILLIS as the read timeout.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

userAgent: String?

The user agent that will be used by the fallback HttpDataSource if needed, or null for the fallback to use the default user agent of the underlying platform.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, the provided fallback HttpDataSource.Factory will be used instead.

Sets DEFAULT_CONNECT_TIMEOUT_MILLIS as the connection timeout, DEFAULT_READ_TIMEOUT_MILLIS as the read timeout.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

transferListener: TransferListener?

An optional listener.

fallbackFactory: HttpDataSource.Factory!

A HttpDataSource.Factory which is used as a fallback in case no suitable CronetEngine can be build.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    userAgent: String?
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, a will be used instead.

Sets DEFAULT_CONNECT_TIMEOUT_MILLIS as the connection timeout, DEFAULT_READ_TIMEOUT_MILLIS as the read timeout.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

transferListener: TransferListener?

An optional listener.

userAgent: String?

The user agent that will be used by the fallback HttpDataSource if needed, or null for the fallback to use the default user agent of the underlying platform.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, the provided fallback HttpDataSource.Factory will be used instead.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

connectTimeoutMs: Int

The connection timeout, in milliseconds.

readTimeoutMs: Int

The read timeout, in milliseconds.

resetTimeoutOnRedirects: Boolean

Whether the connect timeout is reset when a redirect occurs.

fallbackFactory: HttpDataSource.Factory!

A HttpDataSource.Factory which is used as a fallback in case no suitable CronetEngine can be build.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    userAgent: String?
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, a will be used instead.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

connectTimeoutMs: Int

The connection timeout, in milliseconds.

readTimeoutMs: Int

The read timeout, in milliseconds.

resetTimeoutOnRedirects: Boolean

Whether the connect timeout is reset when a redirect occurs.

userAgent: String?

The user agent that will be used by the fallback HttpDataSource if needed, or null for the fallback to use the default user agent of the underlying platform.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    fallbackFactory: HttpDataSource.Factory!
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, the provided fallback HttpDataSource.Factory will be used instead.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

transferListener: TransferListener?

An optional listener.

connectTimeoutMs: Int

The connection timeout, in milliseconds.

readTimeoutMs: Int

The read timeout, in milliseconds.

resetTimeoutOnRedirects: Boolean

Whether the connect timeout is reset when a redirect occurs.

fallbackFactory: HttpDataSource.Factory!

A HttpDataSource.Factory which is used as a fallback in case no suitable CronetEngine can be build.

CronetDataSourceFactory

CronetDataSourceFactory(
    cronetEngineWrapper: CronetEngineWrapper!,
    executor: Executor!,
    transferListener: TransferListener?,
    connectTimeoutMs: Int,
    readTimeoutMs: Int,
    resetTimeoutOnRedirects: Boolean,
    userAgent: String?
)

Creates an instance.

If the CronetEngineWrapper fails to provide a CronetEngine, a will be used instead.

Parameters
cronetEngineWrapper: CronetEngineWrapper!

A CronetEngineWrapper.

executor: Executor!

The java.util.concurrent.Executor that will perform the requests.

transferListener: TransferListener?

An optional listener.

connectTimeoutMs: Int

The connection timeout, in milliseconds.

readTimeoutMs: Int

The read timeout, in milliseconds.

resetTimeoutOnRedirects: Boolean

Whether the connect timeout is reset when a redirect occurs.

userAgent: String?

The user agent that will be used by the fallback HttpDataSource if needed, or null for the fallback to use the default user agent of the underlying platform.

Protected functions

createDataSourceInternal

protected 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.