aboutsummaryrefslogtreecommitdiff
path: root/pages/present.tsx
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-05-15 10:54:55 +0200
committerlonkaars <loek@pipeframe.xyz>2021-05-15 10:54:55 +0200
commitabca906d804e876a01d4c07c226caefeeaca9920 (patch)
treeb37137c609a2bac50b8323603b026ff2b5788cca /pages/present.tsx
parent178cf4cd6bd455c59d7cc98d293d34cd03b08ffb (diff)
timeline display in editor
Diffstat (limited to 'pages/present.tsx')
-rw-r--r--pages/present.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/pages/present.tsx b/pages/present.tsx
index ad3cec2..19ef111 100644
--- a/pages/present.tsx
+++ b/pages/present.tsx
@@ -1,6 +1,7 @@
import Button from '@material-ui/core/Button';
import Ajv from 'ajv';
import { useEffect, useState } from 'react';
+import Timecode from 'timecode-boss';
import timeline, { delaySlide, loopSlide, slide, speedChangeSlide } from '../timeline';
import * as timelineSchema from '../timeline.schema.json';
@@ -12,7 +13,7 @@ import SettingsRoundedIcon from '@material-ui/icons/SettingsRounded';
import CodeRoundedIcon from '@material-ui/icons/CodeRounded';
import MovieRoundedIcon from '@material-ui/icons/MovieRounded';
-class TimedVideoPlayer {
+export class TimedVideoPlayer {
slide: number;
timeline: timeline;
precision: number;
@@ -30,6 +31,11 @@ class TimedVideoPlayer {
this.registeredEventListeners = false;
}
+ frameToTimestampString(frame: number) {
+ var timecodeString = new Timecode(frame, this.framerate).toString();
+ return timecodeString.replace(/^(00:)+/, '') + 'f';
+ }
+
timestampToFrame(timestamp: number): number {
return Math.ceil((timestamp * 1e3) / (1e3 / this.framerate));
}