aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-07-26 09:03:36 +0200
committerlonkaars <loek@pipeframe.xyz>2021-07-26 09:03:36 +0200
commit2e6814caac72044da3aa476c7fa704b2fbfa7180 (patch)
tree582bf8cc1fa3dde1a4a1f8fb58255c749792c134 /pages
parent05e2816aecbfdbcff73c599f3cf4e64ae3bea333 (diff)
/present uses new project file structure
Diffstat (limited to 'pages')
-rw-r--r--pages/present.tsx33
1 files changed, 32 insertions, 1 deletions
diff --git a/pages/present.tsx b/pages/present.tsx
index 09714a9..2757cc5 100644
--- a/pages/present.tsx
+++ b/pages/present.tsx
@@ -1,9 +1,10 @@
import Button from '@material-ui/core/Button';
import { useEffect, useState } from 'react';
import Timecode from 'timecode-boss';
-import Project from '../project';
+import Project, { arrayBufferToBase64 } from '../project';
import timeline, { delaySlide, loopSlide, slide, speedChangeSlide } from '../timeline';
+import DescriptionRoundedIcon from '@material-ui/icons/DescriptionRounded';
import ExitToAppRoundedIcon from '@material-ui/icons/ExitToAppRounded';
import PlayArrowRoundedIcon from '@material-ui/icons/PlayArrowRounded';
import SettingsRemoteRoundedIcon from '@material-ui/icons/SettingsRemoteRounded';
@@ -199,6 +200,8 @@ export default function Present() {
var [dummy, setDummy] = useState(false);
var rerender = () => setDummy(!dummy);
var [player, _setPlayer] = useState(new TimedVideoPlayer());
+ var [project, _setProject] = useState(new Project());
+ player.project = project;
useEffect(() => {
setInterval(() => {
@@ -231,6 +234,7 @@ export default function Present() {
className='control menu'
onClick={() => {
document.getElementById('menu').classList.add('active');
+ rerender();
}}
/>
<div
@@ -272,6 +276,33 @@ export default function Present() {
document.getElementById('menu').classList.remove('active');
}}
/>
+ <input
+ type='file'
+ id='prsprUpload'
+ accept='.prspr'
+ className='dispnone'
+ onChange={event => {
+ var file = event.target.files[0];
+ if (!file) return;
+ var reader = new FileReader();
+ reader.addEventListener('load', async ev => {
+ await project.openProject(ev.target.result as ArrayBuffer);
+
+ player.loadSlides(project.timeline);
+ player.loadVideo(arrayBufferToBase64(project.video.source, project.video.mimetype));
+
+ rerender();
+ });
+ reader.readAsArrayBuffer(file);
+ }}
+ />
+ <Button
+ variant='contained'
+ color='default'
+ children='Load .prspr'
+ onClick={() => document.getElementById('prsprUpload').click()}
+ startIcon={<DescriptionRoundedIcon />}
+ />
{false && <Button
variant='contained'
color='default'