setVolume method
Set volume of player. Allows values from 0.0 to 1.0.
Implementation
Future<void> setVolume(double volume) async {
if (volume < 0.0 || volume > 1.0) {
PipFlutterPlayerUtils.log("Volume must be between 0.0 and 1.0");
throw ArgumentError("Volume must be between 0.0 and 1.0");
}
if (videoPlayerController == null) {
PipFlutterPlayerUtils.log("The data source has not been initialized");
throw StateError("The data source has not been initialized");
}
await videoPlayerController!.setVolume(volume);
_postEvent(PipFlutterPlayerEvent(
PipFlutterPlayerEventType.setVolume,
parameters: <String, dynamic>{_volumeParameter: volume},
));
}