One stream per TV: the next show's stream opens only after the ident has stopped the old one

Paul's Emby provider allows 3 streams across the house. Ahead of the ident only
the next show's details are asked for (IsPlayback=false, no stream); its player
is created once the ident covers the screen and the show under it has faded and
stopped (0.8 s). Neighbour channel look-ups are information-only too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 17:05:46 +00:00
co-authored by Claude Opus 5.5
parent c989ae95d9
commit 1ccdfc9a1f
5 changed files with 34 additions and 12 deletions
@@ -21,6 +21,20 @@ class EmbyPlaybackTest {
private fun fails(block: () -> Unit) {
try { block(); fail("Expected rejection") } catch (_: EmbyCheckException) { }
}
/** One stream per TV (9 November 2026): asking ahead tells the server it's information only; tuning still says playback. */
@Test fun askingAheadIsInformationOnly() {
val fake = Fake(); fake.response = EmbyReply(200, info(source()))
val session = session(fake)
session.prepareForTuning(item, "source-123", ahead = true)
assertFalse(JSONObject(fake.requests.last().body!!).getBoolean("IsPlayback"))
session.prepareForTuning(item, "source-123")
assertTrue(JSONObject(fake.requests.last().body!!).getBoolean("IsPlayback"))
assertTrue(fake.requests.all { it.path.endsWith("/PlaybackInfo") }) // asking never opens the stream itself
}
@Test fun theNextShowOpensOnlyAfterTheOldOneLetsGo() {
// The show under an ident fades for 0.5 s, then stops; the next stream waits longer than that, and well inside the shortest ident.
assertTrue(ONE_STREAM_HANDOVER_MS > 500); assertTrue(ONE_STREAM_HANDOVER_MS + 3_000 < IDENT_STING_MS)
}
@Test fun preparesOnlySelectedSampleWithoutTranscodingOrTokenInUrl() {
val fake = Fake(); fake.response = EmbyReply(200, info(source()))
val session = session(fake); val plan = session.prepare(item)