From 63454761efd1339243a7cc5e8721acd71a3ff63d Mon Sep 17 00:00:00 2001 From: davotoula Date: Tue, 21 Apr 2026 19:42:33 +0100 Subject: [PATCH] fix(playback): bypass cache for live streams opened via ZoomableContentView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Live streams routed through the Live Streams tab go through ShowVideoStreaming → ZoomableContentView, not LiveActivity.kt. ZoomableContentView is generic and was calling VideoView without isLiveStream=true, so live stream segments ended up in SimpleCache. The cached HLS manifest then went stale (live manifests roll constantly) and playback stopped after ~30 seconds. Plumb the flag through the data model: add isLiveStream to MediaUrlVideo, set it true when ShowVideoStreaming constructs the model, and pass it from ZoomableContentView into VideoView. URL heuristic (.m3u8) wasn't viable — that would also bypass cache for on-demand NIP-71 multi-rendition videos and defeat the original feature. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../vitorpamplona/amethyst/ui/components/ZoomableContentView.kt | 1 + .../publicChannels/nip53LiveActivities/ShowVideoStreaming.kt | 1 + .../amethyst/commons/richtext/MediaContentModels.kt | 1 + 3 files changed, 3 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index e9d03260e..61d9add09 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -203,6 +203,7 @@ fun ZoomableContentView( onDialog = { dialogOpen = true }, accountViewModel = accountViewModel, thumbhash = content.thumbhash, + isLiveStream = content.isLiveStream, ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ShowVideoStreaming.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ShowVideoStreaming.kt index bad5dbdfd..edfa6decc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ShowVideoStreaming.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/ShowVideoStreaming.kt @@ -53,6 +53,7 @@ fun ShowVideoStreaming( artworkUri = event.image(), authorName = baseChannel.creatorName(), uri = baseChannel.toNAddr(), + isLiveStream = true, ) } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/richtext/MediaContentModels.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/richtext/MediaContentModels.kt index e439378ba..0ab08e726 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/richtext/MediaContentModels.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/richtext/MediaContentModels.kt @@ -97,6 +97,7 @@ open class MediaUrlVideo( val contentWarning: String? = null, mimeType: String? = null, thumbhash: String? = null, + val isLiveStream: Boolean = false, ) : MediaUrlContent(url, description, hash, dim, blurhash, uri, mimeType, thumbhash) @Immutable