From f81776aca5314ebf9308ba74ccddf21485d83ed1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 22 May 2021 11:21:23 +0200 Subject: timeline cursor moves video time --- package.json | 1 + pages/editor.tsx | 4 ++++ yarn.lock | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/package.json b/package.json index 7ada30e..8b6f2d4 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@mdi/js": "^5.9.55", "@mdi/react": "^1.5.0", "ajv": "^8.3.0", + "mousetrap": "^1.6.5", "next": "^10.2.0", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/pages/editor.tsx b/pages/editor.tsx index 7a7a52b..8f0637b 100644 --- a/pages/editor.tsx +++ b/pages/editor.tsx @@ -166,6 +166,10 @@ function TimelineEditor(props: { var frame = Math.max(0, Math.round(getFrameAtOffset(x - 240, timelineZoom)) - 1); setFrame(frame); scrubberSpring.start({ frame }); + if(props.player.player) { + var player = props.player.player; + player.currentTime = props.player.frameToTimestamp(frame + 1); + } }, { domTarget: scrubberDragRef, eventOptions: { passive: false } }); return <> diff --git a/yarn.lock b/yarn.lock index de857ca..afb925c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1474,6 +1474,11 @@ minimist@^1.2.0: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +mousetrap@^1.6.5: + version "1.6.5" + resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.6.5.tgz#8a766d8c272b08393d5f56074e0b5ec183485bf9" + integrity sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" -- cgit v1.2.3