[Feature] keyboard shortcuts for Fullscreen, mute, volume & Seeking #2999
2 changed files with 5 additions and 16 deletions
|
@ -14,6 +14,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Subscription and file view counts ([#2920](https://github.com/lbryio/lbry-desktop/pull/2920))
|
- Subscription and file view counts ([#2920](https://github.com/lbryio/lbry-desktop/pull/2920))
|
||||||
- Pagination on Library, Publishes, and Transactions page ([#2923](https://github.com/lbryio/lbry-desktop/pull/2923))
|
- Pagination on Library, Publishes, and Transactions page ([#2923](https://github.com/lbryio/lbry-desktop/pull/2923))
|
||||||
- Granular balance information ([#2916](https://github.com/lbryio/lbry-desktop/pull/2916))
|
- Granular balance information ([#2916](https://github.com/lbryio/lbry-desktop/pull/2916))
|
||||||
|
- Keyboard shortcuts for the following actions: ([#2999](https://github.com/lbryio/lbry-desktop/pull/2999))
|
||||||
|
- `→` to Seek Forward
|
||||||
|
- `←` to Seek Backward
|
||||||
|
- `f` to Going Fullscreen
|
||||||
|
- `m` to Mute/Unmute
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,14 @@ const SPACE_BAR_KEYCODE = 32;
|
||||||
const SMALL_F_KEYCODE = 70;
|
const SMALL_F_KEYCODE = 70;
|
||||||
const SMALL_M_KEYCODE = 77;
|
const SMALL_M_KEYCODE = 77;
|
||||||
const ARROW_LEFT_KEYCODE = 37;
|
const ARROW_LEFT_KEYCODE = 37;
|
||||||
const ARROW_UP_KEYCODE = 38;
|
|
||||||
const ARROW_RIGHT_KEYCODE = 39;
|
const ARROW_RIGHT_KEYCODE = 39;
|
||||||
const ARROW_DOWN_KEYCODE = 40;
|
|
||||||
|
|
||||||
const FULLSCREEN_KEYCODE = SMALL_F_KEYCODE;
|
const FULLSCREEN_KEYCODE = SMALL_F_KEYCODE;
|
||||||
const MUTE_KEYCODE = SMALL_M_KEYCODE;
|
const MUTE_KEYCODE = SMALL_M_KEYCODE;
|
||||||
const VOLUME_INCREASE_KEYCODE = ARROW_UP_KEYCODE;
|
|
||||||
const VOLUME_DECREASE_KEYCODE = ARROW_DOWN_KEYCODE;
|
|
||||||
|
|
||||||
const SEEK_FORWARD_KEYCODE = ARROW_RIGHT_KEYCODE;
|
const SEEK_FORWARD_KEYCODE = ARROW_RIGHT_KEYCODE;
|
||||||
const SEEK_BACKWARD_KEYCODE = ARROW_LEFT_KEYCODE;
|
const SEEK_BACKWARD_KEYCODE = ARROW_LEFT_KEYCODE;
|
||||||
|
|
||||||
const VOLUME_STEP = 0.1; // Volume range is 0 to 1
|
|
||||||
const SEEK_STEP = 10; // time to seek in seconds
|
const SEEK_STEP = 10; // time to seek in seconds
|
||||||
|
|
||||||
const VIDEO_JS_OPTIONS = {
|
const VIDEO_JS_OPTIONS = {
|
||||||
|
@ -144,17 +139,6 @@ function VideoViewer(props: Props) {
|
||||||
videoNode.muted = !videoNode.muted;
|
videoNode.muted = !videoNode.muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Volume Shortcuts
|
|
||||||
const volume = videoNode.volume;
|
|
||||||
if (e.keyCode === VOLUME_INCREASE_KEYCODE) {
|
|
||||||
const newVolume = volume + VOLUME_STEP;
|
|
||||||
videoNode.volume = newVolume > 1 ? 1 : newVolume;
|
|
||||||
}
|
|
||||||
if (e.keyCode === VOLUME_DECREASE_KEYCODE) {
|
|
||||||
const newVolume = volume - VOLUME_STEP;
|
|
||||||
videoNode.volume = newVolume < 0 ? 0 : newVolume;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Seeking Shortcuts
|
// Seeking Shortcuts
|
||||||
const duration = videoNode.duration;
|
const duration = videoNode.duration;
|
||||||
const currentTime = videoNode.currentTime;
|
const currentTime = videoNode.currentTime;
|
||||||
|
|
Loading…
Reference in a new issue