Make video seekable
This commit is contained in:
parent
7acfd77df2
commit
abdb48ec46
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue