import Button from '@material-ui/core/Button'; import { useEffect, useState } from 'react'; import ExitToAppRoundedIcon from '@material-ui/icons/ExitToAppRounded'; import PlayArrowRoundedIcon from '@material-ui/icons/PlayArrowRounded'; import SettingsRemoteRoundedIcon from '@material-ui/icons/SettingsRemoteRounded'; import SettingsRoundedIcon from '@material-ui/icons/SettingsRounded'; function previous() { console.log('previous slide'); } function next() { console.log('next slide'); } export default function Present() { useEffect(() => { setInterval(() => { document.getElementById('time').innerText = new Date().toLocaleTimeString(); }, 500); }, []); var [ videoSRC, setVideoSRC ] = useState(""); var [ slides, setSlides ] = useState(); var precision = 3; var framerate = 60; useEffect(() => { var videoEL = document.getElementById("player") as HTMLVideoElement; videoEL.addEventListener('loadeddata', () => { console.log("initial load") }) videoEL.addEventListener('canplaythrough', () => { videoEL.play(); }) setInterval(() => { if(videoEL.paused) return; var frame = Math.round((videoEL.currentTime * 1e3) / (1e3 / framerate)); document.getElementById('frame').innerText = frame.toString(); if (frame >= framerate) { videoEL.pause() console.log(videoEL.currentTime) }; }, 1e3 / (precision * framerate)); }, []); return
{ var file = event.target.files[0]; console.log(event.target.files) if (!file) return; console.log('new fileReader!') var reader = new FileReader(); reader.addEventListener('error', () => { console.log("reader error"); }) reader.addEventListener('abort', () => { console.log("reader abortus"); }) reader.addEventListener('load', ev => { console.log("reader done!") setVideoSRC(ev.target.result as string); }) reader.addEventListener('progress', (progEv) => { console.log(progEv.loaded) }) reader.readAsDataURL(file); }} /> { var file = event.target.files[0]; console.log(event.target.files) if (!file) return; console.log('new fileReader!') var reader = new FileReader(); reader.addEventListener('error', () => { console.log("reader error"); }) reader.addEventListener('abort', () => { console.log("reader abortus"); }) reader.addEventListener('load', ev => { console.log("reader done!") setSlides(JSON.parse(ev.target.result as string)); }) reader.addEventListener('progress', (progEv) => { console.log(progEv.loaded) }) reader.readAsText(file); }} /> { !videoSRC &&
{ document.getElementById('menu').classList.add('active'); }} />
; }