ExoPlayerPool
fun ExoPlayerPool( poolSize: Int = DEFAULT_POOL_SIZE, context: Context, userAgent: String = getUserAgent(context.applicationContext, BuildConfig.LIB_NAME), clock: Clock = Clock.DEFAULT, bandwidthMeterFactory: BandwidthMeterFactory = ExoPlayerConfig.DEFAULT, trackSelectorFactory: TrackSelectorFactory = ExoPlayerConfig.DEFAULT, loadControlFactory: LoadControlFactory = ExoPlayerConfig.DEFAULT, renderersFactory: RenderersFactory = DefaultRenderersFactory(context.applicationContext), defaultMediaSourceFactory: DefaultMediaSourceFactory = with(context) {
val httpDataSource = DefaultHttpDataSource.Factory().setUserAgent(userAgent)
// DefaultMediaSourceFactory
val mediaCache: Cache = ExoPlayerCache.lruCacheSingleton.get(context)
val upstreamFactory = DefaultDataSourceFactory(context, httpDataSource)
val drmSessionManagerProvider = DefaultDrmSessionManagerProvider()
drmSessionManagerProvider.setDrmHttpDataSourceFactory(httpDataSource)
DefaultMediaSourceFactory(
/* dataSourceFactory */ CacheDataSource.Factory()
.setCache(mediaCache)
.setUpstreamDataSourceFactory(upstreamFactory)
.setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
)
.setDrmSessionManagerProvider(drmSessionManagerProvider)
// .setLoadErrorHandlingPolicy() // TODO(eneim): left out, needs more investigations.
})
Content copied to clipboard