diff --git a/playlet-lib/src/components/VideoPlayerDev/TransportController.bs b/playlet-lib/src/components/VideoPlayerDev/TransportController.bs
index 0163569a..93cfda3b 100644
--- a/playlet-lib/src/components/VideoPlayerDev/TransportController.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/TransportController.bs
@@ -84,6 +84,10 @@ namespace TransportController
' shows the time-behind. The clock-anchored edge advances smoothly, so this only needs to absorb position
' notification granularity (~1s) plus a little buffering slack.
const LIVE_EDGE_ATEDGE_MS = 3000
+ ' Leaving the edge while passively TRACKING (idle playback) takes a wider band: position notifications lag
+ ' the clock-driven edge in bursts (segment fetches, brief stalls), and flipping the badge to "0:04" and
+ ' back on every burst reads as flicker. User actions (rewind/seek/commit) keep the tight band.
+ const LIVE_EDGE_ATEDGE_LEAVE_MS = 6000
' The transport state machine.
class Controller
@@ -251,7 +255,7 @@ namespace TransportController
if m.transportMode = TransportController.Mode.Idle
m.cursorMs = ms
if m.isLive
- m.RecomputeLive()
+ m.RecomputeLive(true) ' passive tracking tick -> badge leave-hysteresis
end if
end if
end function
@@ -276,8 +280,10 @@ namespace TransportController
end if
m.edgeMs = ms
m.ClampIdleCursor() ' a re-anchor can regress past a stale in-flight seek cursor
- if m.transportMode = TransportController.Mode.Idle or m.transportMode = TransportController.Mode.LiveDvr
- m.RecomputeLive()
+ if m.transportMode = TransportController.Mode.Idle
+ m.RecomputeLive(true) ' passive tracking tick -> badge leave-hysteresis
+ else if m.transportMode = TransportController.Mode.LiveDvr
+ m.RecomputeLive() ' user-owned cursor -> tight band
end if
end function
@@ -535,7 +541,9 @@ namespace TransportController
' cursor sits behind the edge beyond the stream's inherent latency (liveMinGapMs), and "at the edge" is
' simply that offset being inside the jitter band. Pause, rebuffer, rewind, startup: all just make the
' offset what it really is.
- function RecomputeLive() as void
+ ' tracking=true (the idle 1/s position/edge ticks) adds leave-hysteresis on the badge: once at the
+ ' edge, only a sustained fall-behind drops it. Re-entry, and every user action, stays on the tight band.
+ function RecomputeLive(tracking = false as boolean) as void
raw = m.edgeMs - m.cursorMs
if raw < 0
raw = 0
@@ -554,7 +562,11 @@ namespace TransportController
offset = 0
end if
m.liveOffsetMs = offset
- m.atLiveEdge = (offset <= TransportController.LIVE_EDGE_ATEDGE_MS)
+ threshold = TransportController.LIVE_EDGE_ATEDGE_MS
+ if tracking and m.atLiveEdge
+ threshold = TransportController.LIVE_EDGE_ATEDGE_LEAVE_MS
+ end if
+ m.atLiveEdge = (offset <= threshold)
end function
' ------------------------------------------------------------------------------------------------
diff --git a/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.bs b/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.bs
index c2afe943..de3d3cec 100644
--- a/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.bs
@@ -82,7 +82,9 @@ end function
function RenderLiveBar() as void
transportActive = (m.top.transportMode = TransportController.Mode.LiveDvr)
- showBadge = m.top.atLiveEdge or m.top.forceLiveBadge
+ ' the user seeks BY the offset, so it must be visible from the very first press — a scan's cursor hasn't
+ ' moved yet at entry, so atLiveEdge alone would keep the badge up.
+ showBadge = (m.top.atLiveEdge or m.top.forceLiveBadge) and not transportActive
' Fill + playhead are proportional to the cursor's place in the DVR window [0, effEdge], where
' effEdge = cursor + offset; at the edge the playhead sits at the right end and the fill clips rightward.
diff --git a/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.spec.bs b/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.spec.bs
index e0d846e5..9ee8bcd3 100644
--- a/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.spec.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/TrickPlayBar/TrickPlayBar.spec.bs
@@ -221,6 +221,26 @@ namespace Tests
m.assertEqual(m.top.findNode("remainingLabel").text, "0:17")
end function
+ @it("an active live transport shows the TIME, never the badge — even at the edge or latched")
+ function _()
+ ' the user seeks BY the offset: on the very first press (a scan hasn't moved the cursor yet, so
+ ' atLiveEdge is still true; a reveal latch may still be running) the label must already be the time.
+ m.top.isLive = true
+ m.top.transportMode = TransportController.Mode.LiveDvr
+ m.top.atLiveEdge = true
+ m.top.forceLiveBadge = true
+ m.top.cursorMs = 43200000
+ m.top.liveOffsetMs = 0
+ m.assertFalse(m.top.findNode("bullet").visible)
+ m.assertFalse(m.top.findNode("liveLabel").visible)
+ m.assertEqual(m.top.findNode("remainingLabel").text, "0:00")
+ ' committing back to idle at the edge restores the badge
+ m.top.forceLiveBadge = false
+ m.top.transportMode = TransportController.Mode.Idle
+ m.assertTrue(m.top.findNode("bullet").visible)
+ m.assertTrue(m.top.findNode("liveLabel").visible)
+ end function
+
@it("grows the playhead on the LIVE bar too when the bar tier has focus (behind the edge, idle)")
function _()
' the focus-grow is the same code on both bars, but live is half the player — exercise it here on an
diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs
index fc3d4dba..c01b57c7 100644
--- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs
@@ -61,6 +61,7 @@ function Initialize()
m.videoPlayedSuccessfully = false ' true once the stream has actually played (gates error-retry)
m.chromeMode = ChromeMode.Hidden
+ m.liveBadgeHoldActive = false ' the "● LIVE" reveal hold is running
m.firstFrameSeen = false
m.showFullScreenHint = false
m.focusTarget = PlayerCoordinatorLogic.FocusTarget.Buttons
@@ -238,6 +239,12 @@ function ApplyTransport() as void
' so here mode<>idle while the chrome is still hidden — gating on chromeVisible alone would drop the first
' seek frame until the next tick.
mode = m.transport.transportMode
+
+ ' a live transport seeks by the offset: release the "● LIVE" reveal hold so the time is readable at once.
+ if mode <> TransportController.Mode.Idle
+ CancelLiveBadgeHold()
+ end if
+
chromeVisible = (m.chromeMode = ChromeMode.Shown or m.chromeMode = ChromeMode.FadingIn)
if mode <> TransportController.Mode.Idle or chromeVisible
PushTransportToRenderers()
@@ -606,9 +613,10 @@ function ShowChrome(instant = false as boolean) as void
m.chromeMode = ChromeMode.FadingIn
m.chromeFadeIn.control = "start"
end if
- ' flash "● LIVE" briefly on a live reveal, then let the label swap to the offset M:SS when behind the
- ' edge (signals "this is live"). Label only — the playhead is proportional to the real cursor position.
- if m.transport.isLive
+ ' flash "● LIVE" briefly on an IDLE live reveal, then let the label swap to the offset M:SS when behind
+ ' the edge (signals "this is live"). Label only — the playhead is proportional to the real cursor
+ ' position. A transport-key reveal skips the hold: the user is seeking by the offset.
+ if m.transport.isLive and m.transport.transportMode = TransportController.Mode.Idle
StartLiveBadgeHold()
end if
end if
@@ -624,15 +632,28 @@ function ShowChrome(instant = false as boolean) as void
ArmAutoHide()
end function
-' Force the bar to show "● LIVE" for ~0.6s after a live reveal, then release so it swaps to the offset M:SS
+' Force the bar to show "● LIVE" briefly after a live reveal, then release so it swaps to the offset M:SS
' when behind the edge.
function StartLiveBadgeHold() as void
+ m.liveBadgeHoldActive = true
m.trickPlayBar.forceLiveBadge = true
m.liveBadgeHold.control = "stop"
m.liveBadgeHold.control = "start"
end function
function OnLiveBadgeHoldFire() as void
+ m.liveBadgeHoldActive = false
+ m.trickPlayBar.forceLiveBadge = false
+end function
+
+' Release the hold early (a transport started mid-hold). Guarded so the per-drain call from ApplyTransport
+' is free when no hold is running.
+function CancelLiveBadgeHold() as void
+ if not m.liveBadgeHoldActive
+ return
+ end if
+ m.liveBadgeHoldActive = false
+ m.liveBadgeHold.control = "stop"
m.trickPlayBar.forceLiveBadge = false
end function
diff --git a/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.bs b/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.bs
index a9ac3adf..135c8c4a 100644
--- a/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.bs
@@ -88,6 +88,22 @@ function TestSetControl(value as string) as void
m.top.control = value
end function
+' TestSetLive — flip the loaded content to a rewindable live stream with a known edge: what
+' OnVideoContentJobDone does for real live content (SetContent + DVR window + bar fields), minus the job.
+function TestSetLive(edgeMs as integer) as void
+ m.transport.SetContent(true, 2000, false)
+ m.transport.SetLiveDvrWindow(4 * 3600 * 1000) ' 4h window -> rewindable
+ m.trickPlayBar.isLive = true
+ m.trickPlayBar.canRewind = m.transport.CanRewindLive()
+ m.transport.OnLiveEdge(edgeMs)
+ m.transport.OnPosition(edgeMs)
+end function
+
+' TestFireLiveBadgeHold — fire the liveBadgeHold timer's handler now (the spec can't wait out the real timer).
+function TestFireLiveBadgeHold() as void
+ OnLiveBadgeHoldFire()
+end function
+
' TestPlaybackErrorDialog — seed the error fields, drive OnVideoError down the dialog path, return the dialog's
' message + title.
function TestPlaybackErrorDialog(errorFields as object) as object
@@ -154,5 +170,8 @@ function TestSnapshot() as object
chromeShown: (m.chromeMode = ChromeMode.Shown or m.chromeMode = ChromeMode.FadingIn)
focusTarget: m.focusTarget
focusedButton: m.focusedButton
+ forceLiveBadge: m.trickPlayBar.forceLiveBadge
+ liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible
+ barRemainingText: m.trickPlayBar.findNode("remainingLabel").text
}
end function
diff --git a/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.xml b/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.xml
index 87737cd2..a52913fc 100644
--- a/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.xml
+++ b/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevMock.xml
@@ -47,6 +47,8 @@
+
+
diff --git a/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevSeam.spec.bs b/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevSeam.spec.bs
index a57af0bd..3708617d 100644
--- a/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevSeam.spec.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/tests/VideoPlayerDevSeam.spec.bs
@@ -138,6 +138,58 @@ namespace Tests
m.assertTrue(m.Snap().chromeShown, "Up revealed the chrome")
end function
+ ' The "● LIVE" reveal hold: an idle live reveal flashes the badge briefly (forceLiveBadge) before the
+ ' label swaps to the time-behind-edge — but any live transport must show the TIME immediately (the user
+ ' seeks by it), so a transport-key reveal never starts the hold and a scrub mid-hold releases it.
+ @it("an idle live reveal holds ● LIVE until the hold timer fires")
+ function _()
+ m.top.callFunc("TestSetLive", 43200000) ' 12h stream at the edge
+ m.top.callFunc("TestKey", RemoteKeys.Ok, true) ' idle live reveal (chrome toggle, no pause)
+ snap = m.Snap()
+ m.assertTrue(snap.chromeShown)
+ m.assertTrue(snap.forceLiveBadge, "the reveal forces the badge for the hold window")
+ m.top.callFunc("TestFireLiveBadgeHold")
+ m.assertFalse(m.Snap().forceLiveBadge, "the hold releases -> the offset label may show")
+ end function
+
+ @it("a live scrub from HIDDEN reveals with the time immediately (no ● LIVE hold)")
+ function _()
+ m.top.callFunc("TestSetLive", 43200000)
+ m.top.callFunc("TestKey", RemoteKeys.Left, true) ' rewind from hidden -> transport-key reveal
+ m.top.callFunc("TestKey", RemoteKeys.Left, false)
+ snap = m.Snap()
+ m.assertEqual(snap.transportMode, TransportController.Mode.LiveDvr, "Left entered the live rewind")
+ m.assertTrue(snap.chromeShown)
+ m.assertFalse(snap.forceLiveBadge, "no hold on a transport reveal — the offset must be readable at once")
+ end function
+
+ @it("a live SCAN from hidden (Rev) shows the time immediately — atLiveEdge alone must not keep the badge")
+ function _()
+ ' a scan's cursor hasn't moved on the press (it moves on the first timer tick), so atLiveEdge is
+ ' still true at entry — the bar must suppress the badge for the active transport, not wait a tick.
+ m.top.callFunc("TestSetLive", 43200000)
+ m.top.callFunc("TestKey", RemoteKeys.Rewind, true)
+ m.top.callFunc("TestKey", RemoteKeys.Rewind, false)
+ snap = m.Snap()
+ m.assertEqual(snap.transportMode, TransportController.Mode.LiveDvr, "Rev entered the live scan")
+ m.assertTrue(snap.chromeShown)
+ m.assertFalse(snap.liveBadgeShown, "the ● LIVE badge is gone on the very first press")
+ m.assertEqual(snap.barRemainingText, "0:00", "the offset is readable immediately (counts up from 0:00)")
+ end function
+
+ @it("a live scrub started DURING the reveal hold releases the badge immediately")
+ function _()
+ m.top.callFunc("TestSetLive", 43200000)
+ m.top.callFunc("TestKey", RemoteKeys.Ok, true) ' reveal -> hold running
+ m.assertTrue(m.Snap().forceLiveBadge)
+ m.top.callFunc("TestKey", RemoteKeys.Down, true) ' buttons tier -> bar tier
+ m.top.callFunc("TestKey", RemoteKeys.Left, true) ' scrub back while the hold is still running
+ m.top.callFunc("TestKey", RemoteKeys.Left, false)
+ snap = m.Snap()
+ m.assertEqual(snap.transportMode, TransportController.Mode.LiveDvr)
+ m.assertFalse(snap.forceLiveBadge, "the transport releases the hold — time shows, not ● LIVE")
+ end function
+
' The button tier remembers its highlighted button across a buttons->bar->buttons round-trip; only a
' fresh reveal (the row was hidden) resets the highlight to play/pause.
@it("the button tier keeps its focused button across a bar round-trip; a fresh reveal resets it")
@@ -238,7 +290,7 @@ namespace Tests
classified[name] = "axis"
end for
' flags / scratch — one-shot latches and counters with a single consuming path.
- for each name in ["onCloseCalled", "ignoreNextFinished", "videoPlayedSuccessfully", "firstFrameSeen", "showFullScreenHint", "repauseAfterSeek", "seekToPercent", "watchTimeMarker", "reportWatchTime", "errorDialogNode", "lastCommitSeq", "lastExitSeq", "lastFinishSeq", "liveAstSeconds", "liveFallbackEdgeMs", "liveFallbackAtSeconds"]
+ for each name in ["onCloseCalled", "ignoreNextFinished", "videoPlayedSuccessfully", "firstFrameSeen", "showFullScreenHint", "repauseAfterSeek", "seekToPercent", "watchTimeMarker", "reportWatchTime", "errorDialogNode", "lastCommitSeq", "lastExitSeq", "lastFinishSeq", "liveAstSeconds", "liveFallbackEdgeMs", "liveFallbackAtSeconds", "liveBadgeHoldActive"]
classified[name] = "flag"
end for
' NOT coordinator state — node-scope + test-environment entries, pinned EXPLICITLY (no hidden
diff --git a/playlet-lib/src/source/tests/VideoPlayerDev/TransportController.spec.bs b/playlet-lib/src/source/tests/VideoPlayerDev/TransportController.spec.bs
index 2d511556..78eb7e5b 100644
--- a/playlet-lib/src/source/tests/VideoPlayerDev/TransportController.spec.bs
+++ b/playlet-lib/src/source/tests/VideoPlayerDev/TransportController.spec.bs
@@ -882,18 +882,42 @@ namespace Tests
@it("a pause just IS falling behind: the edge clock keeps counting while the device emits nothing")
function _()
t = m.Live() ' at the edge, min-gap 0
- ' device paused: no position/duration events — only the coordinator's 1s edge heartbeat.
+ ' device paused: no position/duration events — only the coordinator's 1s edge heartbeat. The first
+ ' seconds sit inside the leave-hysteresis band (indistinguishable from position-notification lag),
+ ' so the badge holds; the offset is already counting the truth underneath.
t.OnLiveEdge(304000)
m.assertEqual(t.liveOffsetMs, 4000)
- m.assertFalse(t.atLiveEdge) ' past the jitter band -> the badge swaps to the offset
+ m.assertTrue(t.atLiveEdge) ' within the leave band -> still ● LIVE (no flicker on transient lag)
t.OnLiveEdge(312000)
m.assertEqual(t.liveOffsetMs, 12000) ' counts up in real time WHILE paused (the reveal shows truth)
+ m.assertFalse(t.atLiveEdge) ' sustained fall-behind passed the leave band -> the offset shows
' resume where it paused: the offset keeps reading the true gap.
t.OnPosition(300000)
m.assertFalse(t.atLiveEdge)
m.assertEqual(t.liveOffsetMs, 12000)
end function
+ @it("transient position lag at the edge does NOT flap the badge; re-entry from behind is tight (user flicker)")
+ function _()
+ ' observed on device: idle at the edge, position notifications lag the clock edge by ~4s in bursts
+ ' -> "● LIVE" <-> "0:04" flapping. Once AT the edge, only a sustained fall-behind (past the leave
+ ' band) drops the badge; from BEHIND, re-entry still takes the tight band so a deliberate 5s-behind
+ ' commit reads the time, never the badge.
+ t = m.Live() ' at the edge, min-gap 0
+ t.OnLiveEdge(304000) ' position stalls 4s: inside the leave band
+ m.assertTrue(t.atLiveEdge)
+ t.OnPosition(304000) ' the burst catches up -> offset back to 0
+ m.assertTrue(t.atLiveEdge)
+ m.assertEqual(t.liveOffsetMs, 0)
+ t.OnLiveEdge(311000) ' sustained stall: 7s passes the leave band
+ m.assertFalse(t.atLiveEdge)
+ t.OnPosition(306000) ' still 5s behind: OUTSIDE the tight band -> stays on the offset (no re-flap)
+ m.assertFalse(t.atLiveEdge)
+ m.assertEqual(t.liveOffsetMs, 5000)
+ t.OnPosition(310000) ' rejoined within the tight band -> ● LIVE again
+ m.assertTrue(t.atLiveEdge)
+ end function
+
@it("a resume that rejoins the edge recovers ● LIVE")
function _()
t = m.Live()