setSpeed method

bool setSpeed(
  1. double speed
)

Set playback speed of the player.

speed: The speed to set between 0.5 and 2.

Implementation

bool setSpeed(double speed) {
  if (speed < 0.5) {
    speed = 0.5;
  } else if (speed > 2) {
    speed = 2;
  }
  if (this.speed.value != speed) {
    if (id.value != null) {
      _methodChannel.invokeMethod('setSpeed', {
        'id': id.value,
        'value': speed,
      });
    }
    this.speed.value = speed;
    return true;
  }
  return false;
}