opt: segment (#1831)

* opt: segment

* revert: block config
This commit is contained in:
My-Responsitories
2026-02-10 16:13:38 +08:00
committed by GitHub
parent 0460030a2b
commit ed2bd069ee
6 changed files with 134 additions and 93 deletions

View File

@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:math';
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
@@ -473,14 +474,14 @@ class _PostPanelState extends State<PostPanel>
await videoCtr.play();
}
final delay = start - seek;
if (delay > 0) {
await Future.delayed(Duration(milliseconds: delay));
}
videoCtr.seek(
Duration(
milliseconds: (item.segment.second * 1000).round(),
),
Future<void> seekTo() => videoCtr.seek(
Duration(milliseconds: (item.segment.second * 1000).round()),
);
if (delay > 0) {
Timer(Duration(milliseconds: delay), seekTo);
} else {
seekTo();
}
}
},
),