getVolume method
Implementation
@override
Future<int?> getVolume([String? player]) async {
try {
final output = await _executor.executeCommandWithOutput('volume', player);
debugPrint(
'Raw volume output from playerctl: "$output" for player: $player',
);
if (output != null) {
final volumeDecimal = double.tryParse(output);
final volumePercent = volumeDecimal != null
? (volumeDecimal * 100).round()
: null;
debugPrint(
'Parsed volume: $volumePercent (from decimal: $volumeDecimal)',
);
return volumePercent;
}
debugPrint('Volume output was null');
return null;
} catch (e) {
debugPrint('Error getting volume: $e');
return null;
}
}