StreamMediaDataSource

Centralized provider for Media3 DataSource.Factory instances.

Wraps the base DefaultDataSource.Factory with CDNDataSourceFactory when a custom CDN is configured, enabling URL rewriting and header injection for media playback (video, audio, voice recordings). When a VideoMediaCache is provided, an on-disk cache layer is composed outside the CDN factory so cached bytes are served without re-signing the URL; misses still go through the CDN.

Functions

Link copied to clipboard
fun factory(context: Context, cdn: CDN?, videoCache: VideoMediaCache? = null): DataSource.Factory

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