refactor(gallery): use HlsContentTypes constant and tighten comments
Use the existing HlsContentTypes.HLS_PLAYLIST constant for the canonical HLS playlist mime in GalleryThumb's isHlsMimeType so the read-side stays in sync with the publish path (HlsVideoEventBuilder, HlsPublishOrchestrator). Trim two block comments down to the non-obvious WHY only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-4
@@ -940,10 +940,9 @@ fun ShareMediaAction(
|
||||
if (videoUri != null) {
|
||||
val n19 = Nip19Parser.uriToRoute(postNostrUri)?.entity as? NEvent
|
||||
if (n19 != null) {
|
||||
// Forward the imeta poster (only MediaUrlVideo carries it) so HLS
|
||||
// gallery entries have a still to render — without this, a video
|
||||
// event whose imeta only contains a .m3u8 URL renders as a black
|
||||
// play-icon tile in the gallery.
|
||||
// Forward the imeta poster so HLS gallery entries have a decodable
|
||||
// still — the .m3u8 URL itself is a text manifest. Only
|
||||
// MediaUrlVideo carries an artworkUri.
|
||||
val posterUrl = (content as? MediaUrlVideo)?.artworkUri
|
||||
accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay.getOrNull(0), blurhash, dim, hash, mimeType, image = posterUrl)
|
||||
accountViewModel.toastManager.toast(R.string.media_added, R.string.media_added_to_profile_gallery)
|
||||
|
||||
+4
-3
@@ -39,6 +39,7 @@ import androidx.media3.common.util.UnstableApi
|
||||
import coil3.compose.AsyncImagePainter
|
||||
import coil3.compose.SubcomposeAsyncImage
|
||||
import coil3.compose.SubcomposeAsyncImageContent
|
||||
import com.davotoula.lightcompressor.hls.HlsContentTypes
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
|
||||
import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols
|
||||
@@ -66,11 +67,11 @@ import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent
|
||||
import com.vitorpamplona.quartz.nip68Picture.PictureEvent
|
||||
import com.vitorpamplona.quartz.nip71Video.VideoEvent
|
||||
|
||||
// HLS playlist mime types as published in NIP-71 imeta tags. Mirrors the canonical list used in
|
||||
// MediaItemCache.toExoPlayerMimeType. Kept inline to avoid creating a one-off helper module.
|
||||
// Mirrors the canonical HLS-playlist mime list used in MediaItemCache.toExoPlayerMimeType.
|
||||
// Kept inline rather than extracting a shared helper for one read-side caller.
|
||||
private fun isHlsMimeType(mimeType: String?): Boolean =
|
||||
when (mimeType?.lowercase()) {
|
||||
"application/vnd.apple.mpegurl",
|
||||
HlsContentTypes.HLS_PLAYLIST,
|
||||
"application/x-mpegurl",
|
||||
"audio/x-mpegurl",
|
||||
"audio/mpegurl",
|
||||
|
||||
Reference in New Issue
Block a user