From ef1fecbce401f2043d4d6fba2eb631ceb09963f4 Mon Sep 17 00:00:00 2001 From: zevav Date: Fri, 2 Oct 2020 20:04:23 +0200 Subject: [PATCH] added 30-second jumps with ctrl --- modulearn/TODO.md | 5 +++++ modulearn/src/App.svelte | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modulearn/TODO.md b/modulearn/TODO.md index 6cb3be0..390f197 100644 --- a/modulearn/TODO.md +++ b/modulearn/TODO.md @@ -1,3 +1,6 @@ +- [ ] fix bug where the "current Module" no longer updates after you've navigated outside the bounds + of the modules' timestamps + - [ ] or (easier) require the modules' timestamps to cover the entirety of the recording - [ ] load data from JSON or an API - [ ] validate the data: overlaps? gaps? - [ ] support segments from multiple videos @@ -9,4 +12,6 @@ - [ ] related to above: don't re-render the progress bar to "done" or "empty" in current module right before switch - [ ] make it work decently for mobile! + - [Plyr.js](https://github.com/sampotts/plyr#api) might help with this + - [Svelte Wrapper](https://github.com/benwoodward/svelte-plyr#readme) - [ ] either don't allow going before the first module, or fix it so that the first module isn't highlighted when watching the pre-module content (first solution is easier) diff --git a/modulearn/src/App.svelte b/modulearn/src/App.svelte index 8ab6f9d..84856cf 100644 --- a/modulearn/src/App.svelte +++ b/modulearn/src/App.svelte @@ -44,10 +44,11 @@ } const handleKeyDown = e => { - const { key, code } = e - if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) { + const { key, code, ctrlKey } = e + if (e.shiftKey || e.altKey || e.metaKey) { return } + let amount = 5 if (["j", "ArrowDown"].includes(key)) { e.preventDefault() nextModule() @@ -60,12 +61,18 @@ } else if (["l", "ArrowRight"].includes(key)) { e.preventDefault() clearInterval(interval) - video.jumpTo($position + 5) + if (ctrlKey) { + amount = 30 + } + video.jumpTo($position + amount) positionUpdater() } else if (["h", "ArrowLeft"].includes(key)) { e.preventDefault() clearInterval(interval) - video.jumpTo($position - 5) + if (ctrlKey) { + amount = 30 + } + video.jumpTo($position - amount) positionUpdater() } }