commonMain.tech.skot.libraries.video.SKAudio.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of viewmodel-jvm Show documentation
Show all versions of viewmodel-jvm Show documentation
viewmodel module for SK-Video skot library
package tech.skot.libraries.video
import tech.skot.model.SKData
import tech.skot.model.SKManualData
class SKAudio(private val proxy: SKAudioVC) {
fun setPlayList(tracks: List) {
proxy.trackList = tracks
}
fun addTrackIfNotIn(track: SKAudioVC.Track) {
if (!proxy.trackList.contains(track)) {
proxy.addTrack(track)
}
}
fun play() {
proxy.playing = true
}
var playing:Boolean
get() = proxy.playing
set(value) {
proxy.playing = value
}
fun pause() {
proxy.playing = false
}
fun setCurrentTrack(track: SKAudioVC.Track) {
proxy.setCurrentTrack(track)
}
fun hasNext(): Boolean {
return proxy.hasNext()
}
fun seekToLastTrack() {
proxy.seekToLastTrack()
}
fun setProgressRefreshInterval(ms: Long) {
proxy.progressRefreshInterval = ms
}
var keepActiveInBackGroundWithMessageIfNothingPlayed: String?
get() = proxy.keepActiveInBackGroundWithMessageIfNothingPlayed
set(value) {
proxy.keepActiveInBackGroundWithMessageIfNothingPlayed = value
}
init {
setProgressRefreshInterval(1000L)
}
private val _state = SKManualData(null)
val state: SKData = _state
val currentState:SKAudioVC.State?
get() = _state.value
private val _durations = SKManualData
© 2015 - 2025 Weber Informatics LLC | Privacy Policy