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>

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. })

Functions

Link copied to clipboard
open fun clear()
Link copied to clipboard
open override fun createPlayer(media: Media): Player
Link copied to clipboard
open override fun destroyPlayer(player: Player)
Link copied to clipboard
fun getPlayer(media: Media): Player
Link copied to clipboard
fun putPlayer(media: Media, player: Player): Boolean
Link copied to clipboard
open override fun resetPlayer(player: Player)

Properties

Link copied to clipboard
val defaultMediaSourceFactory: DefaultMediaSourceFactory