mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-14 17:55:58 -07: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",
|
"mute": "Mute",
|
||||||
"volumeUp": "Volume Up",
|
"volumeUp": "Volume Up",
|
||||||
"volumeDown": "Volume Down",
|
"volumeDown": "Volume Down",
|
||||||
|
"speedUp": "Speed Up",
|
||||||
|
"speedDown": "Speed Down",
|
||||||
"nextVideo": "Next Video",
|
"nextVideo": "Next Video",
|
||||||
"prevVideo": "Previous Video",
|
"prevVideo": "Previous Video",
|
||||||
"nextChapter": "Next Chapter",
|
"nextChapter": "Next Chapter",
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ enum VideoHotKeys {
|
||||||
mute,
|
mute,
|
||||||
volumeUp,
|
volumeUp,
|
||||||
volumeDown,
|
volumeDown,
|
||||||
|
speedUp,
|
||||||
|
speedDown,
|
||||||
nextVideo,
|
nextVideo,
|
||||||
prevVideo,
|
prevVideo,
|
||||||
nextChapter,
|
nextChapter,
|
||||||
|
|
@ -38,6 +40,8 @@ enum VideoHotKeys {
|
||||||
VideoHotKeys.mute => context.localized.mute,
|
VideoHotKeys.mute => context.localized.mute,
|
||||||
VideoHotKeys.volumeUp => context.localized.volumeUp,
|
VideoHotKeys.volumeUp => context.localized.volumeUp,
|
||||||
VideoHotKeys.volumeDown => context.localized.volumeDown,
|
VideoHotKeys.volumeDown => context.localized.volumeDown,
|
||||||
|
VideoHotKeys.speedUp => context.localized.speedUp,
|
||||||
|
VideoHotKeys.speedDown => context.localized.speedDown,
|
||||||
VideoHotKeys.nextVideo => context.localized.nextVideo,
|
VideoHotKeys.nextVideo => context.localized.nextVideo,
|
||||||
VideoHotKeys.prevVideo => context.localized.prevVideo,
|
VideoHotKeys.prevVideo => context.localized.prevVideo,
|
||||||
VideoHotKeys.nextChapter => context.localized.nextChapter,
|
VideoHotKeys.nextChapter => context.localized.nextChapter,
|
||||||
|
|
@ -180,6 +184,8 @@ Map<VideoHotKeys, KeyCombination> get _defaultVideoHotKeys => {
|
||||||
VideoHotKeys.mute => KeyCombination(key: LogicalKeyboardKey.keyM),
|
VideoHotKeys.mute => KeyCombination(key: LogicalKeyboardKey.keyM),
|
||||||
VideoHotKeys.volumeUp => KeyCombination(key: LogicalKeyboardKey.arrowUp),
|
VideoHotKeys.volumeUp => KeyCombination(key: LogicalKeyboardKey.arrowUp),
|
||||||
VideoHotKeys.volumeDown => KeyCombination(key: LogicalKeyboardKey.arrowDown),
|
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 =>
|
VideoHotKeys.prevVideo =>
|
||||||
KeyCombination(key: LogicalKeyboardKey.keyP, modifier: LogicalKeyboardKey.shiftLeft),
|
KeyCombination(key: LogicalKeyboardKey.keyP, modifier: LogicalKeyboardKey.shiftLeft),
|
||||||
VideoHotKeys.nextVideo =>
|
VideoHotKeys.nextVideo =>
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ const _$VideoHotKeysEnumMap = {
|
||||||
VideoHotKeys.mute: 'mute',
|
VideoHotKeys.mute: 'mute',
|
||||||
VideoHotKeys.volumeUp: 'volumeUp',
|
VideoHotKeys.volumeUp: 'volumeUp',
|
||||||
VideoHotKeys.volumeDown: 'volumeDown',
|
VideoHotKeys.volumeDown: 'volumeDown',
|
||||||
|
VideoHotKeys.speedUp: 'speedUp',
|
||||||
|
VideoHotKeys.speedDown: 'speedDown',
|
||||||
VideoHotKeys.nextVideo: 'nextVideo',
|
VideoHotKeys.nextVideo: 'nextVideo',
|
||||||
VideoHotKeys.prevVideo: 'prevVideo',
|
VideoHotKeys.prevVideo: 'prevVideo',
|
||||||
VideoHotKeys.nextChapter: 'nextChapter',
|
VideoHotKeys.nextChapter: 'nextChapter',
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,15 @@ class VideoPlayerSettingsProviderNotifier extends StateNotifier<VideoPlayerSetti
|
||||||
ref.read(videoPlayerProvider).setVolume(value);
|
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) =>
|
void toggleOrientation(Set<DeviceOrientation>? orientation) =>
|
||||||
state = state.copyWith(allowedOrientations: orientation);
|
state = state.copyWith(allowedOrientations: orientation);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -697,6 +697,14 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
|
||||||
resetTimer();
|
resetTimer();
|
||||||
ref.read(videoPlayerSettingsProvider.notifier).steppedVolume(-5);
|
ref.read(videoPlayerSettingsProvider.notifier).steppedVolume(-5);
|
||||||
return true;
|
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:
|
case VideoHotKeys.fullScreen:
|
||||||
fullScreenHelper.toggleFullScreen(ref);
|
fullScreenHelper.toggleFullScreen(ref);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue