setSpeed method
Set playback speed of video. Allows to set speed value between 0 and 2.
Implementation
Future<void> setSpeed(double speed) async {
if (speed <= 0 || speed > 2) {
PipFlutterPlayerUtils.log("Speed must be between 0 and 2");
throw ArgumentError("Speed must be between 0 and 2");
}
if (videoPlayerController == null) {
PipFlutterPlayerUtils.log("The data source has not been initialized");
throw StateError("The data source has not been initialized");
}
await videoPlayerController?.setSpeed(speed);
_postEvent(
PipFlutterPlayerEvent(
PipFlutterPlayerEventType.setSpeed,
parameters: <String, dynamic>{
_speedParameter: speed,
},
),
);
}