NativeMediaPlayer

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val currentPosition: Int

Gets the current playback position.

Link copied to clipboard
abstract val duration: Int

Gets the duration of the file.

Link copied to clipboard
@get:RequiresApi(value = 23)
@set:RequiresApi(value = 23)
abstract var speed: Float

Retrieves/Sets the speed factor.

Link copied to clipboard

Gets the current player state.

Functions

Link copied to clipboard
abstract fun pause()

Pauses playback. Call start() to resume.

Link copied to clipboard
abstract fun prepare()

Prepares the player for playback, synchronously.

Link copied to clipboard
abstract fun prepareAsync()

Prepares the player for playback, asynchronously.

Link copied to clipboard
abstract fun release()

Releases resources associated with this MediaPlayer object.

Link copied to clipboard
abstract fun reset()

Resets the MediaPlayer to its uninitialized state. After calling this method, you will have to initialize it again by setting the data source and calling prepare().

Link copied to clipboard
abstract fun seekTo(msec: Int)

Seeks to specified time position.

Link copied to clipboard
abstract fun setDataSource(path: String)

Sets the data source (file-path or http/rtsp URL) to use.

Link copied to clipboard
abstract fun setOnCompletionListener(listener: () -> Unit)

Register a callback to be invoked when the end of a media source has been reached during playback.

Link copied to clipboard
abstract fun setOnErrorListener(listener: (what: Int, extra: Int) -> Boolean)

Register a callback to be invoked when an error has happened during an asynchronous operation.

Link copied to clipboard
abstract fun setOnPreparedListener(listener: () -> Unit)

Register a callback to be invoked when the media source is ready for playback.

Link copied to clipboard
abstract fun start()

Starts or resumes playback. If playback had previously been paused, playback will continue from where it was paused. If playback had been stopped, or never started before, playback will start at the beginning.

Link copied to clipboard
abstract fun stop()

Stops playback after playback has been started or paused.