setVolume method

bool setVolume(
  1. double volume
)

Set the volume of the player.

volume: The volume to set between 0 and 1.

Implementation

bool setVolume(double volume) {
  if (volume < 0) {
    volume = 0;
  } else if (volume > 1) {
    volume = 1;
  }
  if (this.volume.value != volume) {
    _methodChannel.invokeMethod('setVolume', {
      'id': id.value,
      'value': volume,
    });
    this.volume.value = volume;
    return true;
  }
  return false;
}