interface MKPlayerApi: Any
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 timeshifting effect when watching a live stream.
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
|
setVolume
abstract fun setVolume(level: Int)
Sets the volume level on the player. Range 0(mute) to 100 including.
Parameters
| Name | Description |
|---|---|
level: Int
|
volume level to be set |
ReturnValue
| Name | Description |
|---|---|
Unit
|
getVolume
abstract fun getVolume(): Int?
This method returns the current volume level set. Range 0(mute) to 100 including.
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 |
getTimeShift
abstract fun getTimeShift(): Double?
Applicable only for LIVE streams.
ReturnValue
| Name | Description |
|---|---|
Double?
|
current time shift in seconds of the live video. |
setTimeShift
abstract fun setTimeShift(offset: Double)
Shifts the time to the given offset in seconds from the live edge. Has to be within getMaxTimeShift() (which is a negative value) and 0. Only works in live streams. The offset can be positive and is then interpreted as a UNIX timestamp in seconds. The value has to be within the timeShift window, as specified by getMaxTimeShift().
Parameters
| Name | Description |
|---|---|
offset: Double
|
The amount to shift. |
ReturnValue
| Name | Description |
|---|---|
Unit
|
getMaxTimeShift
abstract fun getMaxTimeShift(): Double?
Applicable only for LIVE streams.
ReturnValue
| Name | Description |
|---|---|
Double?
|
the limit in seconds for time shift. Is either negative or 0. |
getVideoBufferLength
abstract fun getVideoBufferLength(): Double?
Returns seconds of already buffered video data.
ReturnValue
| Name | Description |
|---|---|
Double?
|
the seconds of already buffered video data. |
getAudioBufferLength
abstract fun getAudioBufferLength(): Double?
Returns the seconds of already buffered audio data.
ReturnValue
| Name | Description |
|---|---|
Double?
|
the seconds of already buffered audio data. |
getDroppedVideoFrames
abstract fun getDroppedVideoFrames(): Int?
Returns the number of dropped frames.
ReturnValue
| Name | Description |
|---|---|
Int?
|
the total number of dropped frames since playback started. |
getCurrentVideoFrameRate
abstract fun getCurrentVideoFrameRate(): Float?
Returns the currently playing video frame rate.
ReturnValue
| Name | Description |
|---|---|
Float?
|
the currently playing video frame rate as frames per second |
setMaxSelectableVideoBitrate
abstract fun setMaxSelectableVideoBitrate(maxSelectableVideoBitrate: Int)
Sets upper bitrate boundary for video qualities. All qualities above this threshold will not be selected by the ABR logic. These qualities are still available for manual quality selection. For no limitation set to Integer#MAX_VALUE.
Parameters
| Name | Description |
|---|---|
maxSelectableVideoBitrate: Int
|
video bitrate |
ReturnValue
| Name | Description |
|---|---|
Unit
|
isStereo
abstract fun isStereo(): Boolean?
Returns true if stereo is enabled
ReturnValue
| Name | Description |
|---|---|
Boolean?
|
true, if stereo is enabled |
setStereo
abstract fun setStereo(stereo: Boolean)
If true, stereo mode will be enabled. Applicable to VR content.
Parameters
| Name | Description |
|---|---|
stereo: Boolean
|
true/false to enable/disable stereo |
ReturnValue
| Name | Description |
|---|---|
Unit
|
setPlaybackSpeed
abstract fun setPlaybackSpeed(speed: Float)
Sets the playback speed of the player. Fast forward as well as slow motion is supported. Slow motion is used by values between 0 and 1. Fast forward by values greater than 1. Values less or equal zero are ignored.
Parameters
| Name | Description |
|---|---|
speed: Float
|
playback speed |
ReturnValue
| Name | Description |
|---|---|
Unit
|
getPlaybackSpeed
abstract fun getPlaybackSpeed(): Float?
Returns the current playback speed of the player. Value 1 is the default playback speed. Values between 0 and 1 refer to slow motion. Values greater than 1 refer to fast forward.
ReturnValue
| Name | Description |
|---|---|
Float?
|
current playback speed |
getLatency
abstract fun getLatency(): Double?
Returns the current latency.
ReturnValue
| Name | Description |
|---|---|
Double?
|
the current latency. |
setTargetLatency
abstract fun setTargetLatency(latency: Double)
Sets the target latency the player should try to reach and maintain.
Parameters
| Name | Description |
|---|---|
latency: Double
|
target latency the player should try to reach and maintain. |
ReturnValue
| Name | Description |
|---|---|
Unit
|
getTargetLatency
abstract fun getTargetLatency(): Double?
Returns the current target latency.
ReturnValue
| Name | Description |
|---|---|
Double?
|
the current target latency or -1 if not set. |
getSeekableRange
abstract fun getSeekableRange(): MKPTimeRange
Returns the time range that is currently valid for seeking. For VoD streams, the returned time ranges between 0..duration of the asset. For Live streams a value relative to the playback start..current live position is returned.
ReturnValue
| Name | Description |
|---|---|
MKPTimeRange
|
MKPTimeRange returns the range, default values are 0.0. |
getPlaybackVideoData
abstract fun getPlaybackVideoData(): VideoQuality
The VideoQuality that is currently being played back or null if no video is currently being played back. The returned quality always represents the actual current video quality, while getCurrentVideoQuality represents what the player is working towards playing (e.g. a new quality can be selected even though it is not being played yet).
ReturnValue
| Name | Description |
|---|---|
VideoQuality
|
getPlaybackAudioData
abstract fun getPlaybackAudioData(): AudioQuality
The AudioQuality that is currently being played back or null if no audio is currently being played back. The returned quality always represents the actual current audio quality, while getCurrentAudioQuality represents what the player is working towards playing (e.g. a new quality can be selected even though it is not being played yet).
ReturnValue
| Name | Description |
|---|---|
AudioQuality
|
Defines the public API of the MKPlayer.