fix issue that fast seek indicator does not disabpear on fullscreen switch
This commit is contained in:
parent
a5c9baa26d
commit
6ff8f7c1e9
|
@ -49,7 +49,7 @@ interface VideoPlayerViewModel {
|
||||||
fun seekingFinished()
|
fun seekingFinished()
|
||||||
fun embeddedDraggedDown(offset: Float)
|
fun embeddedDraggedDown(offset: Float)
|
||||||
fun fastSeek(count: Int)
|
fun fastSeek(count: Int)
|
||||||
fun fastSeekFinished()
|
fun finishFastSeek()
|
||||||
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
fun onFullscreenToggle(isFullscreen: Boolean) {}
|
fun onFullscreenToggle(isFullscreen: Boolean) {}
|
||||||
|
|
|
@ -279,19 +279,22 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fastSeekFinished() {
|
override fun finishFastSeek() {
|
||||||
val fastSeekAmount = mutableUiState.value.fastseekSeconds
|
val fastSeekAmount = mutableUiState.value.fastseekSeconds
|
||||||
Log.d(TAG, "$fastSeekAmount")
|
if (fastSeekAmount != 0) {
|
||||||
|
Log.d(TAG, "$fastSeekAmount")
|
||||||
|
|
||||||
newPlayer?.currentPosition = (newPlayer?.currentPosition ?: 0) + (fastSeekAmount * 1000)
|
newPlayer?.currentPosition = (newPlayer?.currentPosition ?: 0) + (fastSeekAmount * 1000)
|
||||||
mutableUiState.update {
|
mutableUiState.update {
|
||||||
it.copy(fastseekSeconds = 0)
|
it.copy(fastseekSeconds = 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun switchToEmbeddedView() {
|
override fun switchToEmbeddedView() {
|
||||||
callbackListeners.forEach { it?.onFullscreenToggle(false) }
|
callbackListeners.forEach { it?.onFullscreenToggle(false) }
|
||||||
uiVisibilityJob?.cancel()
|
uiVisibilityJob?.cancel()
|
||||||
|
finishFastSeek()
|
||||||
mutableUiState.update {
|
mutableUiState.update {
|
||||||
it.copy(fullscreen = false, uiVissible = false)
|
it.copy(fullscreen = false, uiVissible = false)
|
||||||
}
|
}
|
||||||
|
@ -300,7 +303,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
||||||
override fun switchToFullscreen() {
|
override fun switchToFullscreen() {
|
||||||
callbackListeners.forEach { it?.onFullscreenToggle(true) }
|
callbackListeners.forEach { it?.onFullscreenToggle(true) }
|
||||||
uiVisibilityJob?.cancel()
|
uiVisibilityJob?.cancel()
|
||||||
|
finishFastSeek()
|
||||||
mutableUiState.update {
|
mutableUiState.update {
|
||||||
it.copy(fullscreen = true, uiVissible = false)
|
it.copy(fullscreen = true, uiVissible = false)
|
||||||
}
|
}
|
||||||
|
@ -371,7 +374,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
||||||
println("dummy impl")
|
println("dummy impl")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fastSeekFinished() {
|
override fun finishFastSeek() {
|
||||||
println("dummy impl")
|
println("dummy impl")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ fun VideoPlayerUI(
|
||||||
seekingFinished = viewModel::seekingFinished,
|
seekingFinished = viewModel::seekingFinished,
|
||||||
embeddedDraggedDownBy = viewModel::embeddedDraggedDown,
|
embeddedDraggedDownBy = viewModel::embeddedDraggedDown,
|
||||||
fastSeek = viewModel::fastSeek,
|
fastSeek = viewModel::fastSeek,
|
||||||
finishFastSeek = viewModel::fastSeekFinished
|
finishFastSeek = viewModel::finishFastSeek
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue