feat: video player keyboard navigation toggle

This commit is contained in:
edde746
2025-12-12 17:05:01 +01:00
parent 263eddbdba
commit b0ee43d8cd
10 changed files with 7227 additions and 14147 deletions
+7179 -14146
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -113,6 +113,8 @@
"videoPlayerControls": "Video Player Controls",
"keyboardShortcuts": "Keyboard Shortcuts",
"keyboardShortcutsDescription": "Customize keyboard shortcuts",
"videoPlayerNavigation": "Video Player Navigation",
"videoPlayerNavigationDescription": "Use arrow keys to navigate video player controls",
"debugLogging": "Debug Logging",
"debugLoggingDescription": "Enable detailed logging for troubleshooting",
"viewLogs": "View Logs",
+2
View File
@@ -114,6 +114,8 @@
"videoPlayerControls": "Videoplayer-Steuerung",
"keyboardShortcuts": "Tastenkürzel",
"keyboardShortcutsDescription": "Tastenkürzel anpassen",
"videoPlayerNavigation": "Videoplayer-Navigation",
"videoPlayerNavigationDescription": "Pfeiltasten zur Navigation der Videoplayer-Steuerung verwenden",
"debugLogging": "Debug-Protokollierung",
"debugLoggingDescription": "Detaillierte Protokolle zur Fehleranalyse aktivieren",
"viewLogs": "Protokolle anzeigen",
+2
View File
@@ -114,6 +114,8 @@
"videoPlayerControls": "Controlli del lettore video",
"keyboardShortcuts": "Scorciatoie da tastiera",
"keyboardShortcutsDescription": "Personalizza le scorciatoie da tastiera",
"videoPlayerNavigation": "Navigazione del lettore video",
"videoPlayerNavigationDescription": "Usa i tasti freccia per navigare nei controlli del lettore video",
"debugLogging": "Log di debug",
"debugLoggingDescription": "Abilita il logging dettagliato per la risoluzione dei problemi",
"viewLogs": "Visualizza log",
+2
View File
@@ -114,6 +114,8 @@
"videoPlayerControls": "Videospeler bediening",
"keyboardShortcuts": "Toetsenbord sneltoetsen",
"keyboardShortcutsDescription": "Pas toetsenbord sneltoetsen aan",
"videoPlayerNavigation": "Videospeler navigatie",
"videoPlayerNavigationDescription": "Gebruik pijltjestoetsen om door de videospeler bediening te navigeren",
"debugLogging": "Debug logging",
"debugLoggingDescription": "Schakel gedetailleerde logging in voor probleemoplossing",
"viewLogs": "Bekijk logs",
+2
View File
@@ -114,6 +114,8 @@
"videoPlayerControls": "Videospelar-kontroller",
"keyboardShortcuts": "Tangentbordsgenvägar",
"keyboardShortcutsDescription": "Anpassa tangentbordsgenvägar",
"videoPlayerNavigation": "Navigering i videospelaren",
"videoPlayerNavigationDescription": "Använd piltangenter för att navigera videospelarens kontroller",
"debugLogging": "Felsökningsloggning",
"debugLoggingDescription": "Aktivera detaljerad loggning för felsökning",
"viewLogs": "Visa loggar",
+2
View File
@@ -114,6 +114,8 @@
"videoPlayerControls": "视频播放器控制",
"keyboardShortcuts": "键盘快捷键",
"keyboardShortcutsDescription": "自定义键盘快捷键",
"videoPlayerNavigation": "视频播放器导航",
"videoPlayerNavigationDescription": "使用方向键导航视频播放器控件",
"debugLogging": "调试日志",
"debugLoggingDescription": "启用详细日志记录以便故障排除",
"viewLogs": "查看日志",
+15
View File
@@ -45,6 +45,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
bool _autoSkipCredits = true;
int _autoSkipDelay = 5;
bool _downloadOnWifiOnly = false;
bool _videoPlayerNavigationEnabled = false;
// Update checking state
bool _isCheckingForUpdate = false;
@@ -72,6 +73,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
_autoSkipCredits = _settingsService.getAutoSkipCredits();
_autoSkipDelay = _settingsService.getAutoSkipDelay();
_downloadOnWifiOnly = _settingsService.getDownloadOnWifiOnly();
_videoPlayerNavigationEnabled =
_settingsService.getVideoPlayerNavigationEnabled();
_isLoading = false;
});
}
@@ -545,6 +548,18 @@ class _SettingsScreenState extends State<SettingsScreen> {
trailing: const AppIcon(Symbols.chevron_right_rounded, fill: 1),
onTap: () => _showKeyboardShortcutsDialog(),
),
SwitchListTile(
secondary: const AppIcon(Symbols.gamepad_rounded, fill: 1),
title: Text(t.settings.videoPlayerNavigation),
subtitle: Text(t.settings.videoPlayerNavigationDescription),
value: _videoPlayerNavigationEnabled,
onChanged: (value) async {
setState(() {
_videoPlayerNavigationEnabled = value;
});
await _settingsService.setVideoPlayerNavigationEnabled(value);
},
),
],
),
);
+15
View File
@@ -4,6 +4,7 @@ import 'package:hotkey_manager/hotkey_manager.dart';
import 'package:plezy/utils/app_logger.dart';
import '../i18n/strings.g.dart';
import 'base_shared_preferences_service.dart';
import 'tv_detection_service.dart';
enum ThemeMode { system, light, dark }
@@ -48,6 +49,8 @@ class SettingsService extends BaseSharedPreferencesService {
static const String _keyCustomDownloadPath = 'custom_download_path';
static const String _keyCustomDownloadPathType = 'custom_download_path_type';
static const String _keyDownloadOnWifiOnly = 'download_on_wifi_only';
static const String _keyVideoPlayerNavigationEnabled =
'video_player_navigation_enabled';
SettingsService._();
@@ -444,6 +447,17 @@ class SettingsService extends BaseSharedPreferencesService {
await setKeyboardHotkeys(getDefaultKeyboardHotkeys());
}
// Video Player Navigation (use arrow keys to navigate video player controls)
Future<void> setVideoPlayerNavigationEnabled(bool enabled) async {
await prefs.setBool(_keyVideoPlayerNavigationEnabled, enabled);
}
bool getVideoPlayerNavigationEnabled() {
// Default: enabled on Android TV, disabled elsewhere
return prefs.getBool(_keyVideoPlayerNavigationEnabled) ??
TvDetectionService.isTVSync();
}
// Helper methods for HotKey serialization
Map<String, dynamic> _serializeHotKey(HotKey hotKey) {
return {
@@ -915,6 +929,7 @@ class SettingsService extends BaseSharedPreferencesService {
prefs.remove(_keyCustomDownloadPath),
prefs.remove(_keyCustomDownloadPathType),
prefs.remove(_keyDownloadOnWifiOnly),
prefs.remove(_keyVideoPlayerNavigationEnabled),
]);
}
@@ -141,6 +141,8 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
int _autoSkipDelay = 5;
Timer? _autoSkipTimer;
double _autoSkipProgress = 0.0;
// Video player navigation (use arrow keys to navigate controls)
bool _videoPlayerNavigationEnabled = false;
@override
void initState() {
@@ -332,6 +334,8 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
_autoSkipIntro = settingsService.getAutoSkipIntro();
_autoSkipCredits = settingsService.getAutoSkipCredits();
_autoSkipDelay = settingsService.getAutoSkipDelay();
_videoPlayerNavigationEnabled =
settingsService.getVideoPlayerNavigationEnabled();
});
// Apply rotation lock setting
@@ -942,7 +946,8 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
}
// On desktop, show controls and focus play/pause on directional input
if (!isMobile && _isDirectionalKey(key)) {
// Only handle navigation if video player navigation is enabled
if (!isMobile && _isDirectionalKey(key) && _videoPlayerNavigationEnabled) {
// If controls are hidden, show them and focus play/pause
if (!_showControls) {
_showControlsWithFocus();