diff --git a/lib/services/keyboard_shortcuts_service.dart b/lib/services/keyboard_shortcuts_service.dart index 88fcc63b..2488c67f 100644 --- a/lib/services/keyboard_shortcuts_service.dart +++ b/lib/services/keyboard_shortcuts_service.dart @@ -45,6 +45,7 @@ class KeyboardShortcutsService { Map get shortcuts => Map.from(_shortcuts); Map get hotkeys => Map.from(_hotkeys); + int get maxVolume => _maxVolume; String getShortcut(String action) { return _shortcuts[action] ?? ''; diff --git a/lib/widgets/video_controls/video_controls.dart b/lib/widgets/video_controls/video_controls.dart index 1258dfc8..efa41286 100644 --- a/lib/widgets/video_controls/video_controls.dart +++ b/lib/widgets/video_controls/video_controls.dart @@ -676,6 +676,18 @@ class _PlexVideoControlsState extends State with WindowListen _hideControls(); } + void _handlePointerSignal(PointerSignalEvent event) { + if (event is PointerScrollEvent && _keyboardService != null) { + final delta = event.scrollDelta.dy; + final volume = widget.player.state.volume; + final maxVol = _keyboardService!.maxVolume.toDouble(); + final newVolume = (volume - delta / 20).clamp(0.0, maxVol); + widget.player.setVolume(newVolume); + SettingsService.getInstance().then((s) => s.setVolume(newVolume)); + _showControlsFromPointerActivity(); + } + } + /// Show controls in response to pointer activity (mouse/trackpad movement). void _showControlsFromPointerActivity() { if (!_showControls) { @@ -1565,6 +1577,7 @@ class _PlexVideoControlsState extends State with WindowListen child: Listener( behavior: HitTestBehavior.translucent, onPointerHover: (_) => _showControlsFromPointerActivity(), + onPointerSignal: _handlePointerSignal, child: MouseRegion( cursor: _showControls ? SystemMouseCursors.basic : SystemMouseCursors.none, onHover: (_) => _showControlsFromPointerActivity(),