setVolume method
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 = 0.0;
} else if (volumeNew > 1.0) {
volumeNew = 1.0;
}
if (volume.value == volumeNew) {
return;
}
volume.value = volumeNew;
if (desktopOrWeb || videoPlayerVolume) {
customDebugPrint("volume is $volumeNew");
await _videoPlayerController?.setVolume(volumeNew * 100);
volumeUpdated();
} else {
try {
VolumeController().setVolume(volumeNew, showSystemUI: false);
} catch (_) {
customDebugPrint(_);
}
}
}