@@ -750,23 +750,27 @@ class _CupertinoControlsState extends State<CupertinoControls>
750750 });
751751 }
752752
753- void _skipBack () {
753+ Future < void > _skipBack () async {
754754 _cancelAndRestartTimer ();
755755 final beginning = Duration .zero.inMilliseconds;
756756 final skip =
757757 (_latestValue.position - const Duration (seconds: 15 )).inMilliseconds;
758- controller.seekTo (Duration (milliseconds: math.max (skip, beginning)));
758+ await controller.seekTo (Duration (milliseconds: math.max (skip, beginning)));
759+ // Restoring the video speed to selected speed
760+ // A delay of 1 second is added to ensure a smooth transition of speed after reversing the video as reversing is an asynchronous function
759761 Future .delayed (const Duration (milliseconds: 1000 ), () {
760762 controller.setPlaybackSpeed (selectedSpeed);
761763 });
762764 }
763765
764- void _skipForward () {
766+ Future < void > _skipForward () async {
765767 _cancelAndRestartTimer ();
766768 final end = _latestValue.duration.inMilliseconds;
767769 final skip =
768770 (_latestValue.position + const Duration (seconds: 15 )).inMilliseconds;
769- controller.seekTo (Duration (milliseconds: math.min (skip, end)));
771+ await controller.seekTo (Duration (milliseconds: math.min (skip, end)));
772+ // Restoring the video speed to selected speed
773+ // A delay of 1 second is added to ensure a smooth transition of speed after forwarding the video as forwaring is an asynchronous function
770774 Future .delayed (const Duration (milliseconds: 1000 ), () {
771775 controller.setPlaybackSpeed (selectedSpeed);
772776 });
0 commit comments