Package kohii.v1.exoplayer

Types

Link copied to clipboard
interface BandwidthMeterFactory
Link copied to clipboard
object ExoPlayerCache

A convenient object to help creating and reusing a Cache for the media content. It supports a lruCacheSingleton which is a SimpleCache that uses the LeastRecentlyUsedCacheEvictor internally, and a downloadCacheSingleton which is a SimpleCache that doesn't evict cache, which is useful to store downloaded content.

Link copied to clipboard
data class ExoPlayerConfig(    clock: Clock = Clock.DEFAULT,     trackSelectorParameters: DefaultTrackSelector.Parameters = Parameters.DEFAULT_WITHOUT_CONTEXT,     trackSelectionFactory: ExoTrackSelection.Factory = AdaptiveTrackSelection.Factory(),     overrideInitialBitrateEstimate: Long = -1,     resetOnNetworkTypeChange: Boolean = true,     slidingWindowMaxWeight: Int = DefaultBandwidthMeter.DEFAULT_SLIDING_WINDOW_MAX_WEIGHT,     enableDecoderFallback: Boolean = true,     allowedVideoJoiningTimeMs: Long = DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS,     extensionRendererMode: Int = DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF,     mediaCodecSelector: MediaCodecSelector = MediaCodecSelector.DEFAULT,     allocator: DefaultAllocator = DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE),     minBufferMs: Int = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,     maxBufferMs: Int = DefaultLoadControl.DEFAULT_MAX_BUFFER_MS,     bufferForPlaybackMs: Int = DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS,     bufferForPlaybackAfterRebufferMs: Int = DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS,     prioritizeTimeOverSizeThresholds: Boolean = DefaultLoadControl.DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS,     targetBufferBytes: Int = DefaultLoadControl.DEFAULT_TARGET_BUFFER_BYTES,     backBufferDurationMs: Int = DefaultLoadControl.DEFAULT_BACK_BUFFER_DURATION_MS,     retainBackBufferFromKeyframe: Boolean = DefaultLoadControl.DEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAME,     cache: Cache? = null) : LoadControlFactory, BandwidthMeterFactory, TrackSelectorFactory

Detailed config for building a com.google.android.exoplayer2.SimpleExoPlayer. Only for advanced user.

Link copied to clipboard
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.

Link copied to clipboard
class HybridMediaItem(val media: Media, val mediaSource: MediaSource) : Media, MediaSource
Link copied to clipboard
open class Kohii(    master: Master,     playableCreator: PlayableCreator<PlayerView> = PlayerViewPlayableCreator(master),     rendererProviderFactory: RendererProviderFactory = ::PlayerViewProvider) : Engine<PlayerView>
Link copied to clipboard
open class KohiiExoPlayer(    context: Context,     clock: Clock = Clock.DEFAULT,     renderersFactory: RenderersFactory = DefaultRenderersFactory(context.applicationContext),     val trackSelector: DefaultTrackSelector = DefaultTrackSelector(context.applicationContext),     loadControl: LoadControl = DefaultLoadControl.Builder().build(),     bandwidthMeter: BandwidthMeter = DefaultBandwidthMeter.Builder(context.applicationContext).build(),     mediaSourceFactory: MediaSourceFactory,     analyticsCollector: AnalyticsCollector = DefaultAnalyticsCollector(clock),     looper: Looper = Util.getCurrentOrMainLooper()) : SimpleExoPlayer, VolumeInfoController, DefaultTrackSelectorHolder

Extend the SimpleExoPlayer to have custom configuration.

Link copied to clipboard
interface LoadControlFactory
Link copied to clipboard
interface MediaSourceFactoryProvider
Link copied to clipboard
open class PlayerViewBridge(    context: Context,     media: Media,     playerPool: PlayerPool<Player>,     mediaSourceFactory: MediaSourceFactory) : AbstractBridge<PlayerView> , Player.Listener
Link copied to clipboard
class PlayerViewBridgeCreator(playerPool: PlayerPool<Player>, mediaSourceFactory: MediaSourceFactory) : BridgeCreator<PlayerView>
Link copied to clipboard
typealias PlayerViewBridgeCreatorFactory = (Context) -> BridgeCreator<PlayerView>
Link copied to clipboard
class PlayerViewPlayable(    master: Master,     media: Media,     config: Playable.Config,     bridge: Bridge<PlayerView>) : AbstractPlayable<PlayerView>
Link copied to clipboard
class PlayerViewPlayableCreator : PlayableCreator<PlayerView>
Link copied to clipboard
class PlayerViewProvider : ViewRendererProvider
Link copied to clipboard
interface TrackSelectorFactory

An interface that is used by the ExoPlayerPool to create a new DefaultTrackSelector when needed.

Functions

Link copied to clipboard
fun ExoPlayerConfig.createDefaultPlayerPool(context: Context, userAgent: String): ExoPlayerPool
Link copied to clipboard
fun createKohii(context: Context, config: ExoPlayerConfig): Kohii

Creates a new Kohii instance using an ExoPlayerConfig. Note that an application should not hold many instance of Kohii.

fun createKohii(    context: Context,     playerCreator: (Context) -> Player? = null,     rendererProviderFactory: RendererProviderFactory = { PlayerViewProvider() }): Kohii

Creates a new Kohii instance using a custom playerCreator and rendererProviderFactory. Note that an application should not hold many instance of Kohii.