MKPlayerApi

interface MKPlayerApi: Any

Defines the public API of the MKPlayer.

Methods

preload

abstract fun preload()

Starts preloading the content of the currently loaded source.

ReturnValue

Name Description
Unit

unload

abstract fun unload()

Unloads the current video source.

ReturnValue

Name Description
Unit

load

abstract fun load(dataSourceUrl: String)

Load the source from the given source url

Parameters

Name Description
dataSourceUrl: String

: source URL path

ReturnValue

Name Description
Unit

load

abstract fun load(sourceConfiguration: MKPSourceConfiguration?)

Load the source from the given source configuration parameters

Parameters

Name Description
sourceConfiguration: MKPSourceConfiguration?

: An object containing various source configuration parameters

ReturnValue

Name Description
Unit

destroy

abstract fun destroy()

Destroys the player and releases all allocated resources.

The player instance must not be used after calling this method.

ReturnValue

Name Description
Unit

getConfig

abstract fun getConfig(): MKPlayerConfiguration?

Returns the current player configuration object of this player instance.

ReturnValue

Name Description
MKPlayerConfiguration?

seek

abstract fun seek(var1: Double)

Seeks to the given playback time.

Seeks to the given playback time specified by the parameter time in seconds. Must not be greater than the total duration of the video. Has no effect when watching a live stream as seeking is not possible.

Parameters

Name Description
var1: Double

The time to seek to.

ReturnValue

Name Description
Unit

getCurrentTime

abstract fun getCurrentTime(): Double

Returns the current playback time in seconds. For VoD streams the returned time ranges between 0 and the duration of the asset. For live streams a Unix timestamp denoting the current playback position is returned.

ReturnValue

Name Description
Double

getDuration

abstract fun getDuration(): Double

Returns the total duration in seconds of the current video or INFINITY if it’s a live stream.

ReturnValue

Name Description
Double

isMuted

abstract fun isMuted(): Boolean

Returns mute state

ReturnValue

Name Description
Boolean

true if muted

isPaused

abstract fun isPaused(): Boolean

Returns Paused state

ReturnValue

Name Description
Boolean

true if paused

isPlaying

abstract fun isPlaying(): Boolean

Returns Playing state

ReturnValue

Name Description
Boolean

true if playing

isStalled

abstract fun isStalled(): Boolean

Returns Stall state

ReturnValue

Name Description
Boolean

true if stall

isLive

abstract fun isLive(): Boolean

Returns playback mode type

ReturnValue

Name Description
Boolean

true if live

play

abstract fun play()

The state of the player should be PREPARED, or PAUSED state to start playing. Play the prepared media item by the player. Playback is started from its current time Successful invoke of this method changes state to PLAYING

ReturnValue

Name Description
Unit

pause

abstract fun pause()

The state of the player should be PLAYING Pauses the media item being played Successful invoke of this method changes state to PAUSED

ReturnValue

Name Description
Unit

seekTo

abstract fun seekTo(time: Double): Void

Moves the media to specified time position Successful invoke of this method in a valid state does not change the state.

Parameters

Name Description
time: Double

to which seek position has to be moved

ReturnValue

Name Description
Void

setVolume

abstract fun setVolume(level: Int): Void

Sets the volume level on the player

Parameters

Name Description
level: Int

volume level to be set

ReturnValue

Name Description
Void

getVolume

abstract fun getVolume(): Int

This method returns the current volume level set.

ReturnValue

Name Description
Int

the current volume level.

mute

abstract fun mute()

This method provides an way to mute the volume of the player

ReturnValue

Name Description
Unit

unMute

abstract fun unMute()

This method provides an way to un-mute and set volume level to previous

ReturnValue

Name Description
Unit

setSubtitle

abstract fun setSubtitle(trackId: String?)

Sets the selected language as sub title. Available tracks can be retrieved with getAvailableSubtitleTracks().

Parameters

Name Description
trackId: String?

id of subtitle to be set

ReturnValue

Name Description
Unit

getAvailableSubtitleTracks

abstract fun getAvailableSubtitleTracks(): List<Subtitles>?

Returns the all available subtitles from the media source

ReturnValue

Name Description
List<Subtitles>?

list of Subtitles

getCurrentSubtitleTrack

abstract fun getCurrentSubtitleTrack(): Subtitles?

Returns the current subtitle track.

ReturnValue

Name Description
Subtitles?

current subtitle

setAudio

abstract fun setAudio(trackId: String?)

Sets the selected audio track. Available tracks can be retrieved with getAvailableAudioTracks().

Parameters

Name Description
trackId: String?

id of audio

ReturnValue

Name Description
Unit

getAvailableAudioTracks

abstract fun getAvailableAudioTracks(): List<AudioTrack>?

Returns the all available audios

ReturnValue

Name Description
List<AudioTrack>?

list of audios

getCurrentAudioTrack

abstract fun getCurrentAudioTrack(): AudioTrack?

Returns the currently used audio track.

ReturnValue

Name Description
AudioTrack?

current audio