From 136febb9366a098bd21835d7cc758dcd3acffe9c Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 13 May 2021 16:55:11 +0200 Subject: read framerate from timeline --- pages/present.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pages/present.tsx b/pages/present.tsx index 7a3f290..26f3e1f 100644 --- a/pages/present.tsx +++ b/pages/present.tsx @@ -1,6 +1,6 @@ import Button from '@material-ui/core/Button'; import Ajv from 'ajv'; -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import timeline, { slide } from '../timeline'; import * as timelineSchema from '../timeline.schema.json'; @@ -20,11 +20,14 @@ class TimedVideoPlayer { video: string; registeredEventListeners: boolean; frame: number; + framerate: number; - constructor(public framerate: number) { + constructor() { this.slide = -1; this.precision = 3; this.frame = 0; + this.framerate = 0; + this.offset = 0; this.registeredEventListeners = false; } @@ -101,6 +104,7 @@ class TimedVideoPlayer { } this.timeline = timeline as timeline; + this.framerate = this.timeline.framerate; this.timeline.slides[-1] = { frame: 0, @@ -151,7 +155,7 @@ export default function Present() { }, 500); }, []); - var player = new TimedVideoPlayer(60); + var player = new TimedVideoPlayer(); useEffect(() => { var videoEL = document.getElementById('player') as HTMLVideoElement; -- cgit v1.2.3