From db9f4da39462fbe34f93576b45e0103d8453a3e2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 27 May 2026 01:28:15 +0000 Subject: [PATCH] =?UTF-8?q?fix(music):=20cover=20IS=20the=20player=20?= =?UTF-8?q?=E2=80=94=20tap=20actually=20starts=20playback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous layout stacked a non-functional static cover (with a decorative play-button overlay) above the real VideoView, so tapping the prominent UI element did nothing while the actual playback widget sat smaller below. Use LoadThumbAndThenVideoView / VideoView as the primary header so the album art is the player's own thumbnail and ExoPlayer handles the tap-to-play / streaming. Falls back to a plain cover only when the event has no playable URL at all (data-integrity case). --- .../amethyst/ui/note/types/MusicTrack.kt | 77 +++++++------------ 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt index f8c89445e4..56a0657fe0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/MusicTrack.kt @@ -137,7 +137,34 @@ fun MusicTrackHeader( } Column(MaterialTheme.colorScheme.replyModifier) { - MusicTrackCover(image, note, accountViewModel) + if (playableUri != null) { + if (image != null) { + LoadThumbAndThenVideoView( + videoUri = playableUri, + mimeType = mimeType, + title = title, + thumbUri = image, + authorName = note.author?.toBestDisplayName(), + roundedCorner = true, + contentScale = ContentScale.FillWidth, + nostrUriCallback = "nostr:${note.toNEvent()}", + accountViewModel = accountViewModel, + ) + } else { + VideoView( + videoUri = playableUri, + mimeType = mimeType, + title = title, + authorName = note.author?.toBestDisplayName(), + roundedCorner = true, + contentScale = ContentScale.FillWidth, + nostrUriCallback = "nostr:${note.toNEvent()}", + accountViewModel = accountViewModel, + ) + } + } else { + MusicTrackCover(image, note, accountViewModel) + } Column( modifier = @@ -195,36 +222,6 @@ fun MusicTrackHeader( } } - if (playableUri != null) { - Spacer(Modifier.padding(top = 4.dp)) - Box(Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))) { - if (image != null) { - LoadThumbAndThenVideoView( - videoUri = playableUri, - mimeType = mimeType, - title = title, - thumbUri = image, - authorName = note.author?.toBestDisplayName(), - roundedCorner = true, - contentScale = ContentScale.FillWidth, - nostrUriCallback = "nostr:${note.toNEvent()}", - accountViewModel = accountViewModel, - ) - } else { - VideoView( - videoUri = playableUri, - mimeType = mimeType, - title = title, - authorName = note.author?.toBestDisplayName(), - roundedCorner = true, - contentScale = ContentScale.FillWidth, - nostrUriCallback = "nostr:${note.toNEvent()}", - accountViewModel = accountViewModel, - ) - } - } - } - description?.takeIf { !makeItShort }?.let { Spacer(Modifier.padding(top = 4.dp)) val tags = remember(noteEvent) { noteEvent.tags.toImmutableListOfLists() } @@ -291,24 +288,6 @@ private fun MusicTrackCover( } else { DefaultImageHeader(note, accountViewModel, imageModifier) } - - Box( - modifier = - Modifier - .align(Alignment.BottomEnd) - .padding(12.dp) - .size(56.dp) - .clip(CircleShape) - .background(MaterialTheme.colorScheme.primary.copy(alpha = 0.92f)), - contentAlignment = Alignment.Center, - ) { - Icon( - symbol = MaterialSymbols.PlayArrow, - contentDescription = null, - tint = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier.size(32.dp), - ) - } } }