From 5489f68c0e75eab76fc16b6257605d5f75b87be4 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Fri, 25 Jun 2021 10:59:57 +0200 Subject: ready state / disabled editor and player --- pages/editor.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'pages') diff --git a/pages/editor.tsx b/pages/editor.tsx index 0290fe1..40aeefc 100644 --- a/pages/editor.tsx +++ b/pages/editor.tsx @@ -71,7 +71,7 @@ interface project { timeline: boolean; video: { available: boolean; - fullyloaded: boolean; + playable: boolean; }; }; update: { @@ -102,7 +102,7 @@ var project = createState({ timeline: false, video: { available: false, - fullyloaded: false, + playable: false, }, }, update: { @@ -504,6 +504,8 @@ function TimelineEditor() { var mouseX = 0; + var ready = useHookstate(project).ready; + var timelineRef = useRef(null); var selectionAreaRef = useRef(null); useEffect(() => { @@ -653,7 +655,7 @@ function TimelineEditor() { }, []); return
@@ -810,6 +812,12 @@ function DefaultSettings() { var reader = new FileReader(); reader.addEventListener('load', ev => { player.loadVideo(ev.target.result as string); + project.ready.video.available.set(true); + + player.player.addEventListener( + 'canplaythrough', + () => project.ready.video.playable.set(true), + ); player.player.addEventListener('play', () => project.timeline.playing.set(true)); player.player.addEventListener('pause', () => project.timeline.playing.set(false)); @@ -949,6 +957,8 @@ export default function Index() { document.addEventListener('gesturechange', preventDefault); }, []); + var ready = useHookstate(project).ready; + return <>
@@ -963,12 +973,12 @@ export default function Index() {
-
+
-
+
{ player.next(); -- cgit v1.2.3