aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-07-18 20:17:39 +0200
committerlonkaars <loek@pipeframe.xyz>2021-07-18 20:17:39 +0200
commite5d8068a4e3301ea51ce427d6fd66f5f734bd370 (patch)
tree58879a72120cc000071910053e9e26a75e3cdcf9 /components
parent02c2d4a90847e23c779866e149c3cf181b574c13 (diff)
semi-working timecode input
Diffstat (limited to 'components')
-rw-r--r--components/timeinput.tsx24
1 files changed, 24 insertions, 0 deletions
diff --git a/components/timeinput.tsx b/components/timeinput.tsx
new file mode 100644
index 0000000..7232494
--- /dev/null
+++ b/components/timeinput.tsx
@@ -0,0 +1,24 @@
+import TextField from '@material-ui/core/TextField';
+import { TimedVideoPlayer } from '../pages/present';
+
+export default function TimecodeInput(props: {
+ value: number;
+ update: (newValue: number) => void;
+ player: TimedVideoPlayer;
+ label: string;
+}) {
+ return <TextField
+ variant='filled'
+ label={props.label}
+ value={props.player.frameToTimestampString(props.value, false)}
+ spellCheck={false}
+ onChange={e => e.preventDefault()}
+ onKeyDown={e => {
+ var mod = 1;
+ if (e.shiftKey) mod = 10;
+
+ if (e.key == 'ArrowUp') props.update(props.value + mod);
+ if (e.key == 'ArrowDown') props.update(props.value - mod);
+ }}
+ />;
+}