Skip to content

Commit

Permalink
fix: seek forward and backward issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vinothvino42 committed Dec 18, 2023
1 parent faedcd2 commit 4bbd563
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/widget/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@ class VideoState extends WidgetState<Video> with PlayerCapabilities {
children: [
CircleButton(
icon: Icons.replay_10_outlined,
onTap: () => widget._controller.playerCapabilities?.seekTo(10000),
onTap: () {
final currentDuration =
widget._controller._playerController?.value.position;
if (currentDuration != null) {
widget._controller.playerCapabilities
?.seekTo(currentDuration.inSeconds - 10);
}
},
),
CircleButton(
icon: getVideoIconStatus(playerController),
Expand All @@ -220,7 +227,14 @@ class VideoState extends WidgetState<Video> with PlayerCapabilities {
),
CircleButton(
icon: Icons.forward_10_outlined,
onTap: () => widget._controller.playerCapabilities?.seekTo(10000),
onTap: () {
final currentDuration =
widget._controller._playerController?.value.position;
if (currentDuration != null) {
widget._controller.playerCapabilities
?.seekTo(currentDuration.inSeconds + 10);
}
},
),
],
),
Expand Down

0 comments on commit 4bbd563

Please sign in to comment.