An ident that fails to play falls back to the silent still card

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 22:14:48 +00:00
co-authored by Claude Opus 5.5
parent da0025a393
commit 8b358f6feb
@@ -121,7 +121,10 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
Box(Modifier.fillMaxSize().graphicsLayer { alpha = fade.value }.background(NightNavy)) {
// Reduce motion: the still card (the logo over the next show's picture) instead of a moving ident, so no sting either
// (Paul, 7 November 2026: sensory settings shape the ident, sound included). Tots keeps its still goodbye.
val video = if (cameo != null || (settings.reduceMotion && mood == null)) null else block?.video ?: identVideo(channel.number, next.startMs)
// An ident that fails to play (a damaged file, a decoder it can't get) falls back to the silent still card. The ident
// only covers a show's last seconds on the schedule's clock, so it never holds up the next programme either way.
var failed by remember { mutableStateOf(false) }
val video = if (failed || cameo != null || (settings.reduceMotion && mood == null)) null else block?.video ?: identVideo(channel.number, next.startMs)
// With idents off, Tots still says goodbye with a picture that doesn't move.
if (mood != null && (!settings.idents || settings.reduceMotion)) Image(cachedPainter(mood.still), null, Modifier.fillMaxSize())
// Every third Tots changeover, a drawn bumper with the cast instead of the filmed ident.
@@ -141,6 +144,11 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
volume = if (block != null) (if (settings.blockIdentSound) 1f else 0f)
else if (mood != null && settings.identSound && !settings.reduceMotion && TotsJingle.take(mood, System.currentTimeMillis())) identVolume(settings.identSoundQuiet)
else if (mood == null && settings.identSound && IdentStings.take(channel.number, System.currentTimeMillis())) identVolume(settings.identSoundQuiet) else 0f
addListener(object : androidx.media3.common.Player.Listener {
override fun onPlayerError(error: androidx.media3.common.PlaybackException) {
android.util.Log.w("OrbitSchedule", "ident channel=${channel.number} failed=${error.errorCodeName}"); failed = true
}
})
prepare(); playWhenReady = true
}
}