diff options
Diffstat (limited to 'pages/present.tsx')
-rw-r--r-- | pages/present.tsx | 8 |
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)); } |