mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
feat: new shortcuts to increase and decrease playback rate
This commit is contained in:
parent
ee0fb85eb5
commit
838c5b3485
5 changed files with 27 additions and 0 deletions
|
|
@ -1302,6 +1302,8 @@
|
|||
"mute": "Mute",
|
||||
"volumeUp": "Volume Up",
|
||||
"volumeDown": "Volume Down",
|
||||
"speedUp": "Speed Up",
|
||||
"speedDown": "Speed Down",
|
||||
"nextVideo": "Next Video",
|
||||
"prevVideo": "Previous Video",
|
||||
"nextChapter": "Next Chapter",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ enum VideoHotKeys {
|
|||
mute,
|
||||
volumeUp,
|
||||
volumeDown,
|
||||
speedUp,
|
||||
speedDown,
|
||||
nextVideo,
|
||||
prevVideo,
|
||||
nextChapter,
|
||||
|
|
@ -38,6 +40,8 @@ enum VideoHotKeys {
|
|||
VideoHotKeys.mute => context.localized.mute,
|
||||
VideoHotKeys.volumeUp => context.localized.volumeUp,
|
||||
VideoHotKeys.volumeDown => context.localized.volumeDown,
|
||||
VideoHotKeys.speedUp => context.localized.speedUp,
|
||||
VideoHotKeys.speedDown => context.localized.speedDown,
|
||||
VideoHotKeys.nextVideo => context.localized.nextVideo,
|
||||
VideoHotKeys.prevVideo => context.localized.prevVideo,
|
||||
VideoHotKeys.nextChapter => context.localized.nextChapter,
|
||||
|
|
@ -180,6 +184,8 @@ Map<VideoHotKeys, KeyCombination> get _defaultVideoHotKeys => {
|
|||
VideoHotKeys.mute => KeyCombination(key: LogicalKeyboardKey.keyM),
|
||||
VideoHotKeys.volumeUp => KeyCombination(key: LogicalKeyboardKey.arrowUp),
|
||||
VideoHotKeys.volumeDown => KeyCombination(key: LogicalKeyboardKey.arrowDown),
|
||||
VideoHotKeys.speedUp => KeyCombination(key: LogicalKeyboardKey.arrowUp, modifier: LogicalKeyboardKey.controlLeft),
|
||||
VideoHotKeys.speedDown => KeyCombination(key: LogicalKeyboardKey.arrowDown, modifier: LogicalKeyboardKey.controlLeft),
|
||||
VideoHotKeys.prevVideo =>
|
||||
KeyCombination(key: LogicalKeyboardKey.keyP, modifier: LogicalKeyboardKey.shiftLeft),
|
||||
VideoHotKeys.nextVideo =>
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ const _$VideoHotKeysEnumMap = {
|
|||
VideoHotKeys.mute: 'mute',
|
||||
VideoHotKeys.volumeUp: 'volumeUp',
|
||||
VideoHotKeys.volumeDown: 'volumeDown',
|
||||
VideoHotKeys.speedUp: 'speedUp',
|
||||
VideoHotKeys.speedDown: 'speedDown',
|
||||
VideoHotKeys.nextVideo: 'nextVideo',
|
||||
VideoHotKeys.prevVideo: 'prevVideo',
|
||||
VideoHotKeys.nextChapter: 'nextChapter',
|
||||
|
|
|
|||
|
|
@ -69,6 +69,15 @@ class VideoPlayerSettingsProviderNotifier extends StateNotifier<VideoPlayerSetti
|
|||
ref.read(videoPlayerProvider).setVolume(value);
|
||||
}
|
||||
|
||||
void steppedSpeed(double i) {
|
||||
final value = double.parse(
|
||||
((ref.read(playbackRateProvider) + i).clamp(0.25, 3))
|
||||
.toStringAsFixed(2),
|
||||
);
|
||||
ref.read(playbackRateProvider.notifier).state = value;
|
||||
ref.read(videoPlayerProvider).setSpeed(value);
|
||||
}
|
||||
|
||||
void toggleOrientation(Set<DeviceOrientation>? orientation) =>
|
||||
state = state.copyWith(allowedOrientations: orientation);
|
||||
|
||||
|
|
|
|||
|
|
@ -697,6 +697,14 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
|
|||
resetTimer();
|
||||
ref.read(videoPlayerSettingsProvider.notifier).steppedVolume(-5);
|
||||
return true;
|
||||
case VideoHotKeys.speedUp:
|
||||
resetTimer();
|
||||
ref.read(videoPlayerSettingsProvider.notifier).steppedSpeed(0.1);
|
||||
return true;
|
||||
case VideoHotKeys.speedDown:
|
||||
resetTimer();
|
||||
ref.read(videoPlayerSettingsProvider.notifier).steppedSpeed(-0.1);
|
||||
return true;
|
||||
case VideoHotKeys.fullScreen:
|
||||
fullScreenHelper.toggleFullScreen(ref);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue