setSpeed method

Future<void> setSpeed(
  1. double speed
)

Sets the playback speed to use when playing is true, where 1.0 is normal speed. Note that values in excess of 1.0 may result in stalls if the playback speed is faster than the player is able to downloaded the audio.

Implementation

Future<void> setSpeed(final double speed) async {
  if (_disposed) return;
  _playbackEvent = _playbackEvent.copyWith(
    updatePosition: position,
    updateTime: DateTime.now(),
  );
  _playbackEventSubject.add(_playbackEvent);
  _speedSubject.add(speed);
  await (await _platform).setSpeed(SetSpeedRequest(speed: speed));
}