ExoPlayerPool
class 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), val 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.
}) : PlayerPool<Player>
Content copied to clipboard
A PlayerPool for the Player implementation. By default it uses the KohiiExoPlayer implementation.
See also
Constructors
Link copied to clipboard
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