0.108.36: the credits squeeze-back

Paul, 6 November 2026, from the approved design. Over a programme's last
minute, before the ident, the picture eases over a second into a frame at
the top left (54%), and what's next fills the rest: the channel's logo,
Next on <channel> (Keep watching for the same series), a countdown, the
next programme's artwork, title and episode, and Later on the channel with
the channel's cast member, bobbing and blinking. Then the ident, and the
next programme on time. The next programme now starts loading as the
squeeze-back begins (72 seconds ahead instead of 12). Not on the Drive-In,
not on Tots in the evening, not under ten minutes, not while catching up.
Settings > Watching: Squeeze-back and The cast, both on. Instant and still
with Reduce motion.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 00:50:05 +00:00
co-authored by Claude Opus 5.5
parent 486c4cd434
commit 706d95b62b
10 changed files with 194 additions and 13 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
versionCode = 195
versionName = "0.108.35-first-launch"
versionCode = 196
versionName = "0.108.36-squeeze-back"
}
buildFeatures { compose = true }
compileOptions { sourceCompatibility = JavaVersion.VERSION_17; targetCompatibility = JavaVersion.VERSION_17 }
@@ -285,7 +285,9 @@ private fun starPath(centre: Offset, outer: Float, inner: Float, turn: Float) =
* One of the cast, with eyes that follow its way. Frightened, each keeps its shape but turns pale and worried, blinking white as
* the power wears off; caught, only its eyes hurry home.
*/
internal fun DrawScope.drawOrbChaser(centre: Offset, r: Float, who: OrbCharacter, dir: OrbDir, scared: Boolean, returning: Boolean, blink: Boolean, wobble: Float) {
internal fun DrawScope.drawOrbChaser(centre: Offset, r: Float, who: OrbCharacter, dir: OrbDir, scared: Boolean, returning: Boolean, blink: Boolean, wobble: Float,
/** Eyes closed for a blink: lines where the eyes are. */
eyesShut: Boolean = false) {
if (!returning) {
val body = if (scared) (if (blink) Color(0xFFE8F0FF) else Color(0xFF4D6BFF)) else who.colour
when (who) {
@@ -330,6 +332,7 @@ internal fun DrawScope.drawOrbChaser(centre: Offset, r: Float, who: OrbCharacter
val look = Offset(dir.dx * r * .14f, dir.dy * r * .14f)
for (side in listOf(-1f, 1f)) {
val eye = centre + Offset(side * r * .34f, -r * .1f)
if (eyesShut && !returning) { drawLine(Color(0xFF14213D), eye - Offset(r * .2f, 0f), eye + Offset(r * .2f, 0f), r * .08f, StrokeCap.Round); continue }
drawCircle(Color.White, r * .26f, eye)
drawCircle(Color(0xFF14213D), r * .13f, eye + look)
}
@@ -66,7 +66,7 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI
connection.connectTimeout = 10_000
connection.readTimeout = request.readTimeoutMs ?: if (request.path == "/Sessions/Logout") 5_000 else 15_000
connection.setRequestProperty("Accept", "application/json")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.35\"")
connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.36\"")
request.token?.let { connection.setRequestProperty("X-Emby-Token", it) }
if (request.method == "POST") {
val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8)
@@ -79,6 +79,8 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl
onShift: (Long) -> Unit = {},
/** Catch Up: back to the channel live. */
onLive: () -> Unit = {},
/** The squeeze-back, 0 to 1: the picture eases into its frame at the top left, with what's next drawn around it. */
squeeze: Float = 0f,
/** Catch Up: held still at its start while the channel's ident plays over it, then plays. */
holdStart: Boolean = false) {
val context = LocalContext.current
@@ -342,8 +344,10 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl
} }
if (window != null) SideEffect { window.onBack = dismiss }
val content: @Composable () -> Unit = {
Box(Modifier.fillMaxSize().background(Color.Black)) {
AndroidView(modifier = Modifier.fillMaxSize(), factory = { nativeContext ->
Box(Modifier.fillMaxSize().background(if (squeeze > 0f) Navy else Color.Black)) {
val framed = if (squeeze <= 0f) Modifier.fillMaxSize() else Modifier.padding(start = (36 * squeeze).dp, top = (60 * squeeze).dp)
.fillMaxWidth(1f - SQUEEZE_SHRINK * squeeze).fillMaxHeight(1f - SQUEEZE_SHRINK * squeeze)
AndroidView(modifier = framed, factory = { nativeContext ->
PlayerView(nativeContext).apply {
useController = false
setOnKeyListener { _, code, event ->
@@ -476,9 +480,9 @@ internal fun EmbyPlaybackDialog(session: EmbySampleSession, plan: EmbyPlaybackPl
Modifier.align(Alignment.TopEnd).padding(top = 32.dp, end = 44.dp))
// The channel's mark, off while the programme bar is up. It's drawn over the picture, never into it.
val bug = scheduled?.let { ChannelBrands.forNumber(it.channel.number)?.bug }?.takeIf { logoSetting }
if (bug != null && ready && !infoVisible && failure == null)
if (bug != null && ready && !infoVisible && failure == null && squeeze == 0f)
Image(painterResource(bug), null, Modifier.align(Alignment.BottomStart).padding(start = 40.dp, bottom = 28.dp).width(108.dp).height(36.dp), alpha = .8f)
if (infoVisible && failure == null && ready) ClassicProgrammeStrip(plan.item, playing,
if (infoVisible && failure == null && ready && squeeze == 0f) ClassicProgrammeStrip(plan.item, playing,
Modifier.align(Alignment.BottomCenter).fillMaxWidth(.86f).padding(bottom = 26.dp), scheduled = scheduled)
ident?.invoke()
if (window == null) intro?.let { IntroOverlay(it) }
@@ -55,11 +55,11 @@ internal const val EARLY_END_GRACE_MS = 3_000L
internal fun finishedEarly(nowMs: Long, endMs: Long) = endMs - nowMs > EARLY_END_GRACE_MS
/** The ident covers the end of a show, usually its credits, so the next one still starts exactly on time. */
internal fun identPhase(startMs: Long, endMs: Long, nowMs: Long, identMs: Long): IdentPhase = when {
internal fun identPhase(startMs: Long, endMs: Long, nowMs: Long, identMs: Long, loadAheadMs: Long = IDENT_LOAD_AHEAD_MS): IdentPhase = when {
endMs - startMs < IDENT_SHORTEST_PROGRAMME_MS -> IdentPhase.None
nowMs >= endMs -> IdentPhase.None
nowMs >= endMs - identMs -> IdentPhase.Showing
nowMs >= endMs - identMs - IDENT_LOAD_AHEAD_MS -> IdentPhase.LoadNext
nowMs >= endMs - identMs - loadAheadMs -> IdentPhase.LoadNext
else -> IdentPhase.None
}
@@ -63,7 +63,13 @@ internal fun ScheduledChannelPlayer(session: EmbySampleSession, channel: SampleC
val block = if (identsOn) blockIdentFor(current, next, specialOn) else null
val identMs = if (block != null) BLOCK_IDENT_MS else identLength(channel.number, next.startMs)
val identsHere = channel is ScheduledChannel && clockOffsetMs == 0L && channel.number != DRIVE_IN_NUMBER && next.startMs == current.endMs && (identsOn || channel.number == TOTS_NUMBER)
val phase = if (identsHere) identPhase(current.startMs, current.endMs, now, identMs) else IdentPhase.None
// The squeeze-back (Paul, 6 November 2026): over the last minute, with the next programme loading from its start.
val squeezeOn = remember { OrbitSettings(settingsContext).squeezeBack }
val calmMotion = remember { OrbitSettings(settingsContext).reduceMotion }
val squeezing = squeezeOn && channel is ScheduledChannel && squeezeBackDue(channel.number, current.startMs, current.endMs, next.startMs, now, if (identsHere) identMs else 0L, clockOffsetMs)
val squeeze by androidx.compose.animation.core.animateFloatAsState(if (squeezing) 1f else 0f,
if (calmMotion) androidx.compose.animation.core.snap() else androidx.compose.animation.core.tween(1_000), label = "squeeze")
val phase = if (identsHere) identPhase(current.startMs, current.endMs, now, identMs, if (squeezeOn) SQUEEZE_MS + IDENT_LOAD_AHEAD_MS else IDENT_LOAD_AHEAD_MS) else IdentPhase.None
// Each changeover in the playback notes, so a missing ident can be explained afterwards.
val notes = remember { java.io.File(settingsContext.noBackupFilesDir, "schedule") }
DisposableEffect(Unit) { FullScreen.active = true; onDispose { FullScreen.active = false } }
@@ -165,7 +171,7 @@ internal fun ScheduledChannelPlayer(session: EmbySampleSession, channel: SampleC
onHandBack = { running ->
if (handoff != null && clockOffsetMs == 0L) { handoff.returned = LiveStream(channel.number, current.startMs, plan, running); true } else false
},
window = window, onShift = onShift, onLive = onLive, holdStart = !catchUpIdentDone,
window = window, onShift = onShift, onLive = onLive, holdStart = !catchUpIdentDone, squeeze = squeeze,
onFirstFrame = { if (heldIdent?.startMs == current.startMs) heldIdent = null; catchUpPicture = true },
onEndedEarly = {
val at = System.currentTimeMillis() + clockOffsetMs
@@ -191,6 +197,7 @@ internal fun ScheduledChannelPlayer(session: EmbySampleSession, channel: SampleC
}
}
}
if (plan != null && squeeze > 0f) SqueezePanel(session, channel, current, next, now, squeeze)
heldIdent?.let { held ->
key(held.startMs) {
val early = endedEarly == held.startMs
@@ -33,7 +33,7 @@ internal class SecureMediaDataSource(private val session: EmbySampleSession) : B
next.instanceFollowRedirects = false
next.connectTimeout = 10_000
next.readTimeout = 20_000
next.setRequestProperty("User-Agent", "OrbitTV/0.108.35")
next.setRequestProperty("User-Agent", "OrbitTV/0.108.36")
next.setRequestProperty("Accept-Encoding", "identity")
session.mediaHeaders(address).forEach { (key, value) -> next.setRequestProperty(key, value) }
if (dataSpec.position != 0L || dataSpec.length != C.LENGTH_UNSET.toLong()) {
@@ -100,6 +100,14 @@ internal class OrbitSettings(context: Context) {
var blockIdentSound: Boolean
get() = saved.getBoolean("block_ident_sound", false)
set(value) { saved.edit().putBoolean("block_ident_sound", value).apply() }
/** The credits squeeze-back: over a programme's last minute, what's next fills the screen beside it. On unless turned off. */
var squeezeBack: Boolean
get() = saved.getBoolean("squeeze_back", true)
set(value) { saved.edit().putBoolean("squeeze_back", value).apply() }
/** The cast in the squeeze-back and promos. */
var castOn: Boolean
get() = saved.getBoolean("cast_on", true)
set(value) { saved.edit().putBoolean("cast_on", value).apply() }
/** Turns off moving presentation such as the Drive-In's curtains. More screens will follow it as they gain motion. */
var reduceMotion: Boolean
get() = saved.getBoolean("reduce_motion", false)
@@ -192,6 +200,8 @@ private fun ViewingDetail(totsOn: Boolean, windingDown: Boolean, onWindDown: (Bo
var identSound by remember { mutableStateOf(settings.identSound) }
var driveInIntro by remember { mutableStateOf(settings.driveInIntro) }
var reduceMotion by remember { mutableStateOf(settings.reduceMotion) }
var squeezeBack by remember { mutableStateOf(settings.squeezeBack) }
var castOn by remember { mutableStateOf(settings.castOn) }
var specialIdents by remember { mutableStateOf(settings.specialIdents) }
var blockIdentSound by remember { mutableStateOf(settings.blockIdentSound) }
var confirming by remember { mutableStateOf(false) }
@@ -214,6 +224,12 @@ private fun ViewingDetail(totsOn: Boolean, windingDown: Boolean, onWindDown: (Bo
SettingLine("Special ident sound", "Play the short sound with each special ident. Off keeps them silent.") {
OrbitButton(if (blockIdentSound) "On" else "Off", Modifier.width(64.dp), selected = blockIdentSound, onClick = { blockIdentSound = !blockIdentSound; settings.blockIdentSound = blockIdentSound })
}
SettingLine("Squeeze-back", "Over a programme's last minute, the credits shrink into a corner and what's next on the channel fills the screen beside them.") {
OrbitButton(if (squeezeBack) "On" else "Off", Modifier.width(64.dp), selected = squeezeBack, onClick = { squeezeBack = !squeezeBack; settings.squeezeBack = squeezeBack })
}
SettingLine("The cast", "Show Ollie, Zip, Blaze, Drift and Luna in the squeeze-back and promos.") {
OrbitButton(if (castOn) "On" else "Off", Modifier.width(64.dp), selected = castOn, onClick = { castOn = !castOn; settings.castOn = castOn })
}
SettingLine("Drive-In curtains", "Play the curtain intro, with its fanfare, as you go into a screening. Back skips it.") {
OrbitButton(if (driveInIntro) "On" else "Off", Modifier.width(64.dp), selected = driveInIntro, onClick = { driveInIntro = !driveInIntro; settings.driveInIntro = driveInIntro })
}
@@ -0,0 +1,103 @@
package tv.orbit.classic
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.tv.material3.Text
import kotlin.math.sin
/**
* The credits squeeze-back (Paul, 6 November 2026, from the approved design): over a programme's last minute the picture eases
* into a frame at the top left and what's next fills the rest, with a cast member who bobs and blinks; then the channel's ident
* as before, and the next programme on time. The next programme starts loading as the squeeze-back begins. Not on the Drive-In,
* not on Tots in the evening, not under ten minutes, not while catching up. Settings › Watching turns it, and the cast, off.
*/
internal const val SQUEEZE_MS = 60_000L
/** How much the picture shrinks: to 54% of the screen. */
internal const val SQUEEZE_SHRINK = .46f
private const val SQUEEZE_SHORTEST_MS = 10 * 60_000L
/** Whether the squeeze-back is showing now: the minute before the ident (or before the end, with no ident). */
internal fun squeezeBackDue(number: Int, startMs: Long, endMs: Long, nextStartMs: Long, nowMs: Long, identMs: Long, offsetMs: Long): Boolean {
if (offsetMs != 0L || number == DRIVE_IN_NUMBER || endMs - startMs < SQUEEZE_SHORTEST_MS || nextStartMs != endMs) return false
if (number == TOTS_NUMBER && totsMood(nowMs).evening) return false
val until = endMs - identMs
return nowMs >= until - SQUEEZE_MS && nowMs < until
}
/** Each channel's cast member in the squeeze-back: Ollie on Tots, the others shared round the rest. */
internal fun squeezeCast(number: Int): OrbCharacter? = if (number == TOTS_NUMBER) null else OrbCharacter.entries[Math.floorMod(number, OrbCharacter.entries.size)]
/** Two programmes of the same series one after the other: Keep watching rather than Next. */
internal fun keepWatching(current: SampleBroadcast, next: SampleBroadcast) = seriesKey(guideTitleParts(current.media.item.title).first) == seriesKey(guideTitleParts(next.media.item.title).first)
/** Everything around the framed picture. The picture itself is the player, drawn smaller underneath. */
@Composable
internal fun SqueezePanel(session: EmbySampleSession, channel: SampleChannel, current: SampleBroadcast, next: SampleBroadcast, nowMs: Long, shown: Float) {
val context = LocalContext.current
val settings = remember { OrbitSettings(context) }
val calm = remember { settings.reduceMotion }
val castOn = remember { settings.castOn }
var t by remember { mutableLongStateOf(0L) }
LaunchedEffect(calm) { if (!calm) { val start = withFrameMillis { it }; while (true) withFrameMillis { t = it - start } } }
val later = remember(next.startMs) { channel.guide(next.endMs, 3) }
val brand = ChannelBrands.forNumber(channel.number)
val keep = keepWatching(current, next)
val (name, detail) = guideTitleParts(next.media.item.title)
val seconds = ((next.startMs - nowMs) / 1000).coerceAtLeast(0)
Box(Modifier.fillMaxSize().graphicsLayer { alpha = shown }) {
if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.padding(start = 36.dp, top = 14.dp).width(120.dp).height(38.dp))
// Beside the picture: what's next.
Column(Modifier.align(Alignment.TopEnd).padding(top = 60.dp, end = 36.dp).width(360.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text(if (keep) "KEEP WATCHING" else "NEXT ON ${(brand?.displayName ?: channel.name).removePrefix("Orbit ").uppercase()}", color = Yellow, fontFamily = Anton, fontSize = 22.sp, maxLines = 1)
Text(if (seconds >= 60) "in about a minute" else "in $seconds seconds", color = Muted, fontSize = 13.sp)
Box(Modifier.fillMaxWidth().height(160.dp).clip(RoundedCornerShape(8.dp)).background(Panel)) {
ProgrammeArtwork(session, channel, next, Modifier.fillMaxSize())
}
Text(if (keep) (detail ?: name) else name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(when {
keep -> "Straight after the credits"
detail != null -> detail
else -> "${next.media.durationMs / 60_000} min"
}, color = Muted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
// Underneath: later on the channel, with its cast member.
Row(Modifier.align(Alignment.BottomCenter).padding(start = 36.dp, end = 36.dp, bottom = 28.dp).fillMaxWidth().height(110.dp)
.background(Panel, RoundedCornerShape(12.dp)).padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
if (castOn) Canvas(Modifier.size(80.dp)) {
val bob = if (calm) 0f else sin(t / 650.0).toFloat() * size.height * .05f
val shut = !calm && (t % 3_400) < 150
val who = squeezeCast(channel.number)
val c = center + Offset(0f, bob)
if (who == null) drawOrbMascot(c, size.minDimension * .26f, blink = shut)
else drawOrbChaser(c, size.minDimension * .34f, who, OrbDir.Right, false, false, false, t / 400f, eyesShut = shut)
}
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text("LATER ON ${(brand?.displayName ?: channel.name).removePrefix("Orbit ").uppercase()}", color = Muted, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.sp)
Row(horizontalArrangement = Arrangement.spacedBy(28.dp)) {
later.forEach { show ->
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
Text(clock(show.startMs), color = Yellow, fontFamily = BarlowCondensed, fontSize = 18.sp)
Text(guideTitleParts(show.media.item.title).first, color = Color.White, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 200.dp))
}
}
}
}
}
}
}
@@ -0,0 +1,48 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Test
import java.time.ZoneId
import java.time.ZonedDateTime
class SqueezeBackTest {
private val minute = 60_000L
private val london = ZoneId.of("Europe/London")
private val noon = ZonedDateTime.of(2026, 11, 6, 12, 0, 0, 0, london).toInstant().toEpochMilli()
private val start = noon; private val end = noon + 30 * minute; private val ident = 7_000L
@Test fun itShowsForTheMinuteBeforeTheIdent() {
assertFalse(squeezeBackDue(106, start, end, end, end - ident - SQUEEZE_MS - 1, ident, 0))
assertTrue(squeezeBackDue(106, start, end, end, end - ident - SQUEEZE_MS, ident, 0))
assertTrue(squeezeBackDue(106, start, end, end, end - ident - 1, ident, 0))
// The ident takes over.
assertFalse(squeezeBackDue(106, start, end, end, end - ident, ident, 0))
// With no ident, right to the end.
assertTrue(squeezeBackDue(106, start, end, end, end - 1, 0, 0))
}
@Test fun notWhereItDoesntBelong() {
val at = end - ident - 30_000
assertFalse(squeezeBackDue(DRIVE_IN_NUMBER, start, end, end, at, ident, 0))
assertFalse(squeezeBackDue(106, end - 5 * minute, end, end, at, ident, 0)) // under ten minutes
assertFalse(squeezeBackDue(106, start, end, end + minute, at, ident, 0)) // a gap before the next
assertFalse(squeezeBackDue(106, start, end, end, at, ident, -3_600_000)) // catching up
val evening = ZonedDateTime.of(2026, 11, 6, 19, 0, 0, 0, london).toInstant().toEpochMilli()
assertFalse(squeezeBackDue(TOTS_NUMBER, evening, evening + 30 * minute, evening + 30 * minute, evening + 30 * minute - ident - 10_000, ident, 0))
assertTrue(squeezeBackDue(TOTS_NUMBER, start, end, end, at, ident, 0))
}
@Test fun theNextProgrammeLoadsFromTheStartOfTheSqueezeBack() {
val ahead = SQUEEZE_MS + IDENT_LOAD_AHEAD_MS
assertEquals(IdentPhase.LoadNext, identPhase(start, end, end - ident - SQUEEZE_MS, ident, ahead))
assertEquals(IdentPhase.None, identPhase(start, end, end - ident - SQUEEZE_MS, ident))
}
@Test fun keepWatchingForTheSameShowAndACastMemberPerChannel() {
fun show(title: String, at: Long) = SampleBroadcast(ScheduledMedia(SampleItem(title, "Episode", 30, "", "i$at", 30 * minute), "s$at", 30 * minute), at)
assertTrue(keepWatching(show("Fawlty Towers / S1 E3 / The Wedding Party", start), show("Fawlty Towers / S1 E4 / The Hotel Inspectors", end)))
assertFalse(keepWatching(show("The X-Files / S1 E1 / Pilot", start), show("Fringe / S1 E1 / Pilot", end)))
assertNull(squeezeCast(TOTS_NUMBER)); assertNotNull(squeezeCast(106))
assertEquals(squeezeCast(106), squeezeCast(106))
}
}