Make video seekable

This commit is contained in:
Christian Schabesberger 2024-07-29 12:44:10 +02:00
parent 7acfd77df2
commit abdb48ec46
1 changed files with 6 additions and 1 deletions

View File

@ -109,6 +109,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
// private
private val mutableUiState = MutableStateFlow(VideoPlayerUIState.DEFAULT)
private var currentContentRatio = 1F
private var uiVisibilityJob: Job? = null
private var progressUpdaterJob: Job? = null
@ -225,6 +226,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun pause() {
uiVisibilityJob?.cancel()
newPlayer?.pause()
}
override fun prevStream() {
@ -295,7 +297,10 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun seekingFinished() {
resetHideUiDelayedJob()
Log.d(TAG, "TODO: Implement seeking Finished")
val seekerPosition = mutableUiState.value.seekerPosition
val seekPositionInMs = (player?.duration?.toFloat() ?: 0F) * seekerPosition
player?.seekTo(seekPositionInMs.toLong())
Log.i(TAG, "Seek to Ms: $seekPositionInMs")
}
override fun switchToEmbeddedView() {