mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-06-29 18:40:40 +02:00
Improving the video switching from blurhash to video
This commit is contained in:
@ -182,28 +182,7 @@ fun VideoView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!automaticallyStartPlayback.value) {
|
if (blurhash == null) {
|
||||||
if (blurhash != null) {
|
|
||||||
val ratio = aspectRatio(dimensions)
|
|
||||||
val modifier = if (ratio != null && roundedCorner) {
|
|
||||||
Modifier.aspectRatio(ratio)
|
|
||||||
} else {
|
|
||||||
Modifier
|
|
||||||
}
|
|
||||||
|
|
||||||
Box(modifier, contentAlignment = Alignment.Center) {
|
|
||||||
DisplayBlurHash(blurhash, null, ContentScale.Crop, MaterialTheme.colorScheme.imageModifier)
|
|
||||||
IconButton(
|
|
||||||
modifier = Modifier.size(Size75dp),
|
|
||||||
onClick = { automaticallyStartPlayback.value = true }
|
|
||||||
) {
|
|
||||||
DownloadForOfflineIcon(Size75dp, Color.White)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ImageUrlWithDownloadButton(url = videoUri, showImage = automaticallyStartPlayback)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
val ratio = aspectRatio(dimensions)
|
val ratio = aspectRatio(dimensions)
|
||||||
val modifier = if (ratio != null && roundedCorner) {
|
val modifier = if (ratio != null && roundedCorner) {
|
||||||
Modifier.aspectRatio(ratio)
|
Modifier.aspectRatio(ratio)
|
||||||
@ -212,6 +191,9 @@ fun VideoView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Box(modifier) {
|
Box(modifier) {
|
||||||
|
if (!automaticallyStartPlayback.value) {
|
||||||
|
ImageUrlWithDownloadButton(url = videoUri, showImage = automaticallyStartPlayback)
|
||||||
|
} else {
|
||||||
VideoViewInner(
|
VideoViewInner(
|
||||||
videoUri = videoUri,
|
videoUri = videoUri,
|
||||||
defaultToStart = defaultToStart,
|
defaultToStart = defaultToStart,
|
||||||
@ -231,6 +213,44 @@ fun VideoView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
val ratio = aspectRatio(dimensions)
|
||||||
|
val modifier = if (ratio != null && roundedCorner) {
|
||||||
|
Modifier.aspectRatio(ratio)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(modifier, contentAlignment = Alignment.Center) {
|
||||||
|
if (!automaticallyStartPlayback.value) {
|
||||||
|
DisplayBlurHash(blurhash, null, ContentScale.Crop, MaterialTheme.colorScheme.imageModifier)
|
||||||
|
IconButton(
|
||||||
|
modifier = Modifier.size(Size75dp),
|
||||||
|
onClick = { automaticallyStartPlayback.value = true }
|
||||||
|
) {
|
||||||
|
DownloadForOfflineIcon(Size75dp, Color.White)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VideoViewInner(
|
||||||
|
videoUri = videoUri,
|
||||||
|
defaultToStart = defaultToStart,
|
||||||
|
title = title,
|
||||||
|
thumb = thumb,
|
||||||
|
roundedCorner = roundedCorner,
|
||||||
|
topPaddingForControllers = topPaddingForControllers,
|
||||||
|
waveform = waveform,
|
||||||
|
artworkUri = artworkUri,
|
||||||
|
authorName = authorName,
|
||||||
|
dimensions = dimensions,
|
||||||
|
blurhash = blurhash,
|
||||||
|
nostrUriCallback = nostrUriCallback,
|
||||||
|
automaticallyStartPlayback = automaticallyStartPlayback,
|
||||||
|
onControllerVisibilityChanged = onControllerVisibilityChanged,
|
||||||
|
onDialog = onDialog
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
Reference in New Issue
Block a user