fix(video): never gate stall recovery on ad-break state

The native ad-break flag is only re-evaluated by the periodic time
observer, which stops firing while paused (and
canUseNetworkResourcesForLiveStreamingWhilePaused = false blocks new
metadata too) — so a stall inside an ad pod froze isActive at true and
recovery deferred forever, leaving streams permanently paused on launch
when a stitched preroll was running. Verified against Apple docs:
addPeriodicTimeObserver fires periodically only during playback.

The deferral wasn't pulling its weight anyway: ad-transition glitches
resolve well inside the 8s stall window, and attempt-1 recovery
(seek to live edge + play) is harmless mid-pod.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Tommy Chow 2026-06-12 09:21:15 -07:00
parent e527b63217
commit b3e224d8be

View file

@ -703,14 +703,12 @@ abstract class NativeVideoStoreBase
return;
}
// Ad-pod transitions cause brief discontinuities that look like stalls.
// Defer (not skip) recovery so a genuine stall surviving the ad break
// still gets handled once the break ends.
if (_isAdBreakActive) {
debugPrint('NativeVideoStore: stall during ad break, deferring recovery');
_startStallRecoveryTimer();
return;
}
// Note: recovery deliberately does NOT defer during ad breaks. Ad-pod
// transition glitches resolve well inside the 8s stall window, attempt-1
// recovery (seek to edge + play) is harmless mid-pod, and the native
// ad-break flag can freeze at true when paused (the time observer that
// re-evaluates it stops firing) — gating recovery on it deadlocks the
// player into a permanent pause.
// When a stream ends the HLS server stops serving segments, causing
// the player to stall indefinitely. Skip recovery if the stream is