factory

fun factory(context: Context, cdn: CDN?): DataSource.Factory

Creates a DataSource.Factory that handles both local and network media URIs.

When a CDN is provided, HTTP/HTTPS requests are transformed through CDN.fileRequest for URL rewriting and header injection. Local URIs (file://, content://) pass through unchanged.

Parameters

context

The context used to create the base data source.

cdn

Optional custom CDN for transforming network requests.