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
private val mutableUiState = MutableStateFlow(VideoPlayerUIState.DEFAULT) private val mutableUiState = MutableStateFlow(VideoPlayerUIState.DEFAULT)
private var currentContentRatio = 1F private var currentContentRatio = 1F
private var uiVisibilityJob: Job? = null private var uiVisibilityJob: Job? = null
private var progressUpdaterJob: Job? = null private var progressUpdaterJob: Job? = null
@ -225,6 +226,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun pause() { override fun pause() {
uiVisibilityJob?.cancel() uiVisibilityJob?.cancel()
newPlayer?.pause() newPlayer?.pause()
} }
override fun prevStream() { override fun prevStream() {
@ -295,7 +297,10 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun seekingFinished() { override fun seekingFinished() {
resetHideUiDelayedJob() 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() { override fun switchToEmbeddedView() {