fix(livetv): debounce rapid time-shift skips to stop overshoot

This commit is contained in:
edde746
2026-06-06 10:48:51 +02:00
parent 32421e4c84
commit f74314bbf0
14 changed files with 511 additions and 17 deletions
+7 -2
View File
@@ -190,6 +190,7 @@ class KeyboardShortcutsService extends ChangeNotifier {
VoidCallback? onZoomReset,
int? currentPositionEpoch,
ValueChanged<int>? onLiveSeek,
ValueChanged<int>? onLiveSeekBy,
Future<void> Function(Duration position)? onSeekRequested,
}) {
final isRepeat = event is KeyRepeatEvent;
@@ -276,6 +277,7 @@ class KeyboardShortcutsService extends ChangeNotifier {
onZoomReset: onZoomReset,
currentPositionEpoch: currentPositionEpoch,
onLiveSeek: onLiveSeek,
onLiveSeekBy: onLiveSeekBy,
onSeekRequested: onSeekRequested,
);
return KeyEventResult.handled;
@@ -304,11 +306,14 @@ class KeyboardShortcutsService extends ChangeNotifier {
VoidCallback? onZoomReset,
int? currentPositionEpoch,
ValueChanged<int>? onLiveSeek,
ValueChanged<int>? onLiveSeekBy,
Future<void> Function(Duration position)? onSeekRequested,
}) {
void performSeek(int offsetSeconds) {
if (onLiveSeek != null && currentPositionEpoch != null) {
onLiveSeek(currentPositionEpoch + offsetSeconds);
// Relative live-TV skip: route through the parent accumulator, which
// coalesces a rapid burst into one transcode re-open (#1253).
if (onLiveSeekBy != null) {
onLiveSeekBy(offsetSeconds);
} else {
final target = clampSeekPosition(player, player.state.position + Duration(seconds: offsetSeconds));
unawaited((onSeekRequested ?? player.seek)(target));