fix issue that fast seek indicator does not disabpear on fullscreen switch

This commit is contained in:
Christian Schabesberger 2024-08-07 19:01:16 +02:00
parent a5c9baa26d
commit 6ff8f7c1e9
3 changed files with 12 additions and 9 deletions

View File

@ -49,7 +49,7 @@ interface VideoPlayerViewModel {
fun seekingFinished()
fun embeddedDraggedDown(offset: Float)
fun fastSeek(count: Int)
fun fastSeekFinished()
fun finishFastSeek()
interface Listener {
fun onFullscreenToggle(isFullscreen: Boolean) {}

View File

@ -279,8 +279,9 @@ class VideoPlayerViewModelImpl @Inject constructor(
}
}
override fun fastSeekFinished() {
override fun finishFastSeek() {
val fastSeekAmount = mutableUiState.value.fastseekSeconds
if (fastSeekAmount != 0) {
Log.d(TAG, "$fastSeekAmount")
newPlayer?.currentPosition = (newPlayer?.currentPosition ?: 0) + (fastSeekAmount * 1000)
@ -288,10 +289,12 @@ class VideoPlayerViewModelImpl @Inject constructor(
it.copy(fastseekSeconds = 0)
}
}
}
override fun switchToEmbeddedView() {
callbackListeners.forEach { it?.onFullscreenToggle(false) }
uiVisibilityJob?.cancel()
finishFastSeek()
mutableUiState.update {
it.copy(fullscreen = false, uiVissible = false)
}
@ -300,7 +303,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun switchToFullscreen() {
callbackListeners.forEach { it?.onFullscreenToggle(true) }
uiVisibilityJob?.cancel()
finishFastSeek()
mutableUiState.update {
it.copy(fullscreen = true, uiVissible = false)
}
@ -371,7 +374,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
println("dummy impl")
}
override fun fastSeekFinished() {
override fun finishFastSeek() {
println("dummy impl")
}

View File

@ -165,7 +165,7 @@ fun VideoPlayerUI(
seekingFinished = viewModel::seekingFinished,
embeddedDraggedDownBy = viewModel::embeddedDraggedDown,
fastSeek = viewModel::fastSeek,
finishFastSeek = viewModel::fastSeekFinished
finishFastSeek = viewModel::finishFastSeek
)
}
}