android, desktop: local video encryption (#3678)

* android, desktop: local video encryption

* refactor

* different look of progress indicator

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
Stanislav Dmitrenko
2024-01-15 22:00:57 +07:00
committed by GitHub
parent 46fe0fc671
commit be0c791c43
14 changed files with 194 additions and 61 deletions
@@ -33,9 +33,9 @@ actual class VideoPlayer actual constructor(
override val duration: MutableState<Long> = mutableStateOf(defaultDuration)
override val preview: MutableState<ImageBitmap> = mutableStateOf(defaultPreview)
init {
setPreviewAndDuration()
}
// Currently unused because we use low-quality preview
// init { setPreviewAndDuration() }
val player = ExoPlayer.Builder(androidAppContext,
DefaultRenderersFactory(androidAppContext))
@@ -69,7 +69,7 @@ actual class VideoPlayer actual constructor(
}
private fun start(seek: Long? = null, onProgressUpdate: (position: Long?, state: TrackState) -> Unit): Boolean {
val filepath = getAppFilePath(uri)
val filepath = if (uri.scheme == "file") uri.toFile().absolutePath else getAppFilePath(uri)
if (filepath == null || !File(filepath).exists()) {
Log.e(TAG, "No such file: $filepath")
brokenVideo.value = true