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