atLiveEdge function
Whether position counts as sitting at the live edge of window.
Exactly the inverse of behindOf returning a value; kept as its own function so UI code reads as intent rather than as a null check.
判断 position 是否算作处于 window 的直播边缘。
与 behindOf 返回非空恰好互为反面;单独成函数是为了让 UI 代码读起来是 意图表达,而不是一次 null 判断。
position: current playhead within the window / 窗口内的当前播放位置window: seekable window length / 可拖动窗口长度edgeThreshold: gap still counted as live / 仍算作直播的差距阈值
Returns whether playback is at the live edge / 返回是否处于直播边缘。
Implementation
bool atLiveEdge(Duration position, Duration window, Duration edgeThreshold) =>
behindOf(position, window, edgeThreshold) == null;