mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-07 11:02:45 +00:00
multiplatform: stop video playback when swiping away (#6588)
* android/build.gralde.kts: add JAVA_HOME to PATH * fullScreenView: dispose player.stop when view changes * fullScreenView: stop the video playback midway swipe Previously, video playback stopped **only** when screen was fully swiped away to next item. * ImageFullScreenView: simplify * revert back VideoView
This commit is contained in:
+4
-1
@@ -158,7 +158,10 @@ fun ImageFullScreenView(imageProvider: () -> ImageGalleryProvider, close: () ->
|
||||
val uriDecrypted = remember(media.uri.path) { mutableStateOf(if (media.fileSource?.cryptoArgs == null) media.uri else media.fileSource.decryptedGet()) }
|
||||
val decrypted = uriDecrypted.value
|
||||
if (decrypted != null) {
|
||||
VideoView(modifier, decrypted, preview, index == settledCurrentPage, close)
|
||||
// settledCurrentPage finishes **only** when fully swiped
|
||||
// So we use pagerState.currentPage that changes right away as the screen is being dragged
|
||||
val isCurrentPage = index == pagerState.currentPage && kotlin.math.abs(pagerState.currentPageOffsetFraction) < 0.3f
|
||||
VideoView(modifier, decrypted, preview, isCurrentPage, close)
|
||||
DisposableEffect(Unit) {
|
||||
onDispose { playersToRelease.add(decrypted) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user