Skip to content

Commit

Permalink
fix: seek duration
Browse files Browse the repository at this point in the history
Signed-off-by: bggRGjQaUbCoE <[email protected]>
  • Loading branch information
bggRGjQaUbCoE committed Jan 22, 2025
1 parent 773f23f commit 71060a4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/pages/player/player_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -851,10 +851,13 @@ class _PlayerItemState extends State<PlayerItem>
playerController.pause();
final double scale =
180000 / MediaQuery.sizeOf(context).width;
var ms = playerController
.currentPosition.inMilliseconds +
(details.delta.dx * scale).round();
ms = ms > 0 ? ms : 0;
int ms = (playerController
.currentPosition.inMilliseconds +
(details.delta.dx * scale).round())
.clamp(
0,
playerController
.duration.inMilliseconds);
playerController.currentPosition =
Duration(milliseconds: ms);
}, onHorizontalDragEnd: (DragEndDetails details) {
Expand Down

0 comments on commit 71060a4

Please sign in to comment.