setVolume method

Future<void> setVolume(
  1. double volume
)
inherited

Sets the soft volume in percent: 100 plays at unity and values above it amplify. mpv's scale is cubic: 130 is about +7 dB, 1000 is +60 dB.

Takes 0 to 1000. Throws RangeError when negative, and MpvCommandException above 1000, which mpv refuses. PlayerSettings.volumeMax does not cap this call: it bounds mpv's relative steps (add, cycle) only. Clamp a slider to it yourself.

Implementation

Future<void> setVolume(double volume) async {
  _checkRange(volume, 0, double.maxFinite, 'volume');
  await _gate();
  final value = canonicalFloat(volume);
  await _calls.prop('volume', value.toString());
  _updateField((s) => s.copyWith(volume: value), _reactives.volume, value);
}