setVolume method
Sets the volume (0.0 to 1.0).
Implementation
Future<void> setVolume(double volume) async {
try {
// Clamp volume to valid range
final clampedVolume = volume.clamp(0.0, 1.0);
if (!_disposed) {
_volumeSubject.add(clampedVolume);
}
await MymediaPlatform.instance.setVolume(clampedVolume);
} catch (e) {
_handleError(
PlayerException('volume_error', 'Error setting volume', {
'volume': volume,
'error': e,
}),
);
}
}