BaseMediaManager

abstract class BaseMediaManager(mediaSurfaceProvider: MediaSurfaceProvider?, coroutineContext: CoroutineContext) : MediaManager, CoroutineScope

An abstract implementation for MediaManager

Parameters

mediaSurfaceProvider

a MediaSurfaceProvider that will automatically call renderVideoOnSurface for the latest MediaSurface

coroutineContext

the CoroutineContext on which the media will be managed

Inheritors

Constructors

Link copied to clipboard
constructor(mediaSurfaceProvider: MediaSurfaceProvider?, coroutineContext: CoroutineContext)

Types

Link copied to clipboard
interface Builder

Builder for creating a BaseMediaManager

Properties

Link copied to clipboard
Link copied to clipboard
abstract val currentVolume: Flow<Float>

The volume of the audio playback. A value of 0.0 indicates silence; a value of 1.0 (the default) indicates full audio volume for the player instance.

Link copied to clipboard
open override val events: Flow<MediaManager.Event>

A Flow of all the Event detected by the media manager

Functions

Link copied to clipboard
open override fun close()

Releases all resources associated with the media manager. This method should be called when done with the media manager. After calling this playback is disabled. Any subsequent calls will result in a PlaybackError.PlaybackHasEnded

Link copied to clipboard
suspend override fun createPlayableMedia(source: MediaSource): PlayableMedia?

Attempts to create a PlayableMedia for a given MediaSource

Link copied to clipboard
abstract fun initialize(playableMedia: PlayableMedia)

Initializes to manage for a given PlayableMedia

Link copied to clipboard
abstract fun pause()

Pauses playback

Link copied to clipboard
abstract fun play(rate: Float)

Starts playback at a given rate

Link copied to clipboard
abstract suspend fun renderVideoOnSurface(surface: MediaSurface?)

Renders the video component of any initialized PlayableMedia on a MediaSurface

Link copied to clipboard
override fun reset()

Resets the media manager to an uninitialized state. After calling this initialize will have to be called again.

Link copied to clipboard
suspend override fun seekTo(duration: Duration): Boolean

Seeks to a specified time position. Will suspend until seek has completed

Link copied to clipboard
abstract fun stop()

Stops playback

Link copied to clipboard
abstract suspend fun updateVolume(volume: Float)

Updates the currentVolume