setVolume method

Future<void> setVolume(
  1. double volumeNew, {
  2. bool videoPlayerVolume = false,
})

Sets the audio volume volume indicates a value between 0.0 (silent) and 1.0 (full volume) on a linear scale.

Implementation

Future<void> setVolume(double volumeNew,
    {bool videoPlayerVolume = false}) async {
  if (volumeNew >= 0.0 && volumeNew <= 1.0) {
    volume.value = volumeNew;
    if (desktopOrWeb || videoPlayerVolume) {
      customDebugPrint("volume is $volumeNew");
      await _videoPlayerController?.setVolume(volumeNew);
      volumeUpdated();
    } else {
      try {
        VolumeController().setVolume(volumeNew, showSystemUI: false);
      } catch (_) {
        customDebugPrint(_);
      }
    }
  }

  //
}