Skip to content

Commit 13c4760

Browse files
committed
Fixed : Playback speed reset on forwarding video
1 parent 43ab7d6 commit 13c4760

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/src/cupertino/cupertino_controls.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
4949
bool _subtitleOn = false;
5050
Timer? _bufferingDisplayTimer;
5151
bool _displayBufferingIndicator = false;
52-
52+
double selectedSpeed = 1.0;
5353
late VideoPlayerController controller;
5454

5555
// We know that _chewieController is set in didChangeDependencies
@@ -559,6 +559,8 @@ class _CupertinoControlsState extends State<CupertinoControls>
559559

560560
if (chosenSpeed != null) {
561561
controller.setPlaybackSpeed(chosenSpeed);
562+
563+
selectedSpeed = chosenSpeed;
562564
}
563565

564566
if (_latestValue.isPlaying) {
@@ -754,6 +756,9 @@ class _CupertinoControlsState extends State<CupertinoControls>
754756
final skip =
755757
(_latestValue.position - const Duration(seconds: 15)).inMilliseconds;
756758
controller.seekTo(Duration(milliseconds: math.max(skip, beginning)));
759+
Future.delayed(const Duration(milliseconds: 100), () {
760+
controller.setPlaybackSpeed(selectedSpeed);
761+
});
757762
}
758763

759764
void _skipForward() {
@@ -762,6 +767,9 @@ class _CupertinoControlsState extends State<CupertinoControls>
762767
final skip =
763768
(_latestValue.position + const Duration(seconds: 15)).inMilliseconds;
764769
controller.seekTo(Duration(milliseconds: math.min(skip, end)));
770+
Future.delayed(Duration(milliseconds: 100), () {
771+
controller.setPlaybackSpeed(selectedSpeed);
772+
});
765773
}
766774

767775
void _startHideTimer() {

0 commit comments

Comments
 (0)