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) {
|
if (videoUri != null) {
|
||||||
val n19 = Nip19Parser.uriToRoute(postNostrUri)?.entity as? NEvent
|
val n19 = Nip19Parser.uriToRoute(postNostrUri)?.entity as? NEvent
|
||||||
if (n19 != null) {
|
if (n19 != null) {
|
||||||
// Forward the imeta poster (only MediaUrlVideo carries it) so HLS
|
// Forward the imeta poster so HLS gallery entries have a decodable
|
||||||
// gallery entries have a still to render — without this, a video
|
// still — the .m3u8 URL itself is a text manifest. Only
|
||||||
// event whose imeta only contains a .m3u8 URL renders as a black
|
// MediaUrlVideo carries an artworkUri.
|
||||||
// play-icon tile in the gallery.
|
|
||||||
val posterUrl = (content as? MediaUrlVideo)?.artworkUri
|
val posterUrl = (content as? MediaUrlVideo)?.artworkUri
|
||||||
accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay.getOrNull(0), blurhash, dim, hash, mimeType, image = posterUrl)
|
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)
|
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.AsyncImagePainter
|
||||||
import coil3.compose.SubcomposeAsyncImage
|
import coil3.compose.SubcomposeAsyncImage
|
||||||
import coil3.compose.SubcomposeAsyncImageContent
|
import coil3.compose.SubcomposeAsyncImageContent
|
||||||
|
import com.davotoula.lightcompressor.hls.HlsContentTypes
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
|
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
|
||||||
import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols
|
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.nip68Picture.PictureEvent
|
||||||
import com.vitorpamplona.quartz.nip71Video.VideoEvent
|
import com.vitorpamplona.quartz.nip71Video.VideoEvent
|
||||||
|
|
||||||
// HLS playlist mime types as published in NIP-71 imeta tags. Mirrors the canonical list used in
|
// Mirrors the canonical HLS-playlist mime list used in MediaItemCache.toExoPlayerMimeType.
|
||||||
// MediaItemCache.toExoPlayerMimeType. Kept inline to avoid creating a one-off helper module.
|
// Kept inline rather than extracting a shared helper for one read-side caller.
|
||||||
private fun isHlsMimeType(mimeType: String?): Boolean =
|
private fun isHlsMimeType(mimeType: String?): Boolean =
|
||||||
when (mimeType?.lowercase()) {
|
when (mimeType?.lowercase()) {
|
||||||
"application/vnd.apple.mpegurl",
|
HlsContentTypes.HLS_PLAYLIST,
|
||||||
"application/x-mpegurl",
|
"application/x-mpegurl",
|
||||||
"audio/x-mpegurl",
|
"audio/x-mpegurl",
|
||||||
"audio/mpegurl",
|
"audio/mpegurl",
|
||||||
|
|||||||
Reference in New Issue
Block a user