@@ -750,23 +750,27 @@ class _CupertinoControlsState extends State<CupertinoControls>
750
750
});
751
751
}
752
752
753
- void _skipBack () {
753
+ Future < void > _skipBack () async {
754
754
_cancelAndRestartTimer ();
755
755
final beginning = Duration .zero.inMilliseconds;
756
756
final skip =
757
757
(_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
759
761
Future .delayed (const Duration (milliseconds: 1000 ), () {
760
762
controller.setPlaybackSpeed (selectedSpeed);
761
763
});
762
764
}
763
765
764
- void _skipForward () {
766
+ Future < void > _skipForward () async {
765
767
_cancelAndRestartTimer ();
766
768
final end = _latestValue.duration.inMilliseconds;
767
769
final skip =
768
770
(_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
770
774
Future .delayed (const Duration (milliseconds: 1000 ), () {
771
775
controller.setPlaybackSpeed (selectedSpeed);
772
776
});
0 commit comments