commonMain.tech.skot.libraries.video.SKVideo.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.core.components.SKComponent
import tech.skot.libraries.video.di.skvideoViewInjector
/**
* A Video Component
* Based on ExoPlayer for Android
* no iOs Version at this time
*
* @param url url of video you want play
* @param playingInitial indicate if the video should play automatically when ready
* @param soundInitial indicate if the soud should be on or of
*
* @property playing indicate if the video should play, play if true, pause if false
*
*/
class SKVideo(
urlInitial: String?,
useCache: Boolean = false,
playingInitial: Boolean = true,
soundInitial: Boolean = false,
onFullScreen: ((fullScreen: Boolean) -> Unit)? = null,
) :
SKComponent() {
override val view: SKVideoVC = skvideoViewInjector.skVideo(
url = urlInitial,
useCache = useCache,
onFullScreen = onFullScreen,
playingInitial = playingInitial,
soundInitial = soundInitial,
)
var url: String? = urlInitial
set(value) {
field = value
view.url = value
}
var playing: Boolean = playingInitial
set(value) {
field = value
view.playing = value
}
var sound: Boolean = soundInitial
set(value) {
field = value
view.sound = value
}
fun onPause() {
view.onPause()
}
fun onResume() {
view.onResume()
}
fun setCurrentPosition(position: Long) {
view.setCurrentPosition(position)
}
val currentPosition: Long?
get() = view.currentPosition
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy