From bba9a3cb8648ca865ca0c32565e66b48b9ab6f5a Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 21 Jul 2021 20:13:59 +0200 Subject: project file beginnings --- package.json | 3 + pages/editor.tsx | 35 ++-- project.ts | 93 +++++++++++ public/mediainfo/MediaInfoModule.wasm | Bin 0 -> 2526420 bytes public/mediainfo/mediainfo.d.ts | 44 +++++ public/mediainfo/mediainfo.min.js | 16 ++ public/mediainfo/mediainfo.min.js.map | 1 + public/mediainfo/types.d.ts | 114 +++++++++++++ yarn.lock | 293 ++++++++++++++++++++++++++++++++-- 9 files changed, 572 insertions(+), 27 deletions(-) create mode 100644 project.ts create mode 100644 public/mediainfo/MediaInfoModule.wasm create mode 100644 public/mediainfo/mediainfo.d.ts create mode 100644 public/mediainfo/mediainfo.min.js create mode 100644 public/mediainfo/mediainfo.min.js.map create mode 100644 public/mediainfo/types.d.ts diff --git a/package.json b/package.json index 85414be..f59dfce 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,9 @@ "@types/mousetrap": "^1.6.8", "@types/uuid": "^8.3.0", "ajv": "^8.3.0", + "copy-webpack-plugin": "^9.0.1", + "jszip": "^3.6.0", + "mediainfo.js": "^0.1.5", "mousetrap": "^1.6.5", "next": "^11.0.1", "react": "^17.0.2", diff --git a/pages/editor.tsx b/pages/editor.tsx index 9460605..47402ec 100644 --- a/pages/editor.tsx +++ b/pages/editor.tsx @@ -17,6 +17,7 @@ import KeybindSelector from '../components/keybindselector'; import PlaySkipIconAni from '../components/play-skip'; import Selection from '../components/selection'; import TimecodeInput from '../components/timeinput'; +import Project, { LocalVideo } from '../project'; import timeline, { anySlide, clickThroughBehaviours, @@ -545,7 +546,7 @@ function TimelineSelection(props: { selectionDragArea: Ref; }) { var sel = global.selection.slides.attach(Downgraded).value .map(s => ({ id: s.id.toString(), type: s.type.toString() })) - .filter(s => slideTypes.includes(s.type)); + .filter(s => slideTypes.includes(s.type as slideTypes)); sel.forEach(slide => global.timeline.workingTimeline.find(s => s.value?.id == slide.id).set(none)); global.update.refreshLiveTimeline.value(); @@ -1141,20 +1142,23 @@ function DefaultSettings() { { var file = event.target.files[0]; if (!file) return; var reader = new FileReader(); reader.addEventListener('load', ev => { - player.loadSlides(ev.target.result as string); - project.timeline.set(player.timeline); - global.timeline.workingTimeline.set(player.timeline.slides); - global.update.refreshLiveTimeline.value(); - global.ready.timeline.set(true); + var proj = new Project(); + proj.video = new LocalVideo(); + proj.video.load(ev.target.result as ArrayBuffer); + // player.loadSlides(ev.target.result as string); + // project.timeline.set(player.timeline); + // global.timeline.workingTimeline.set(player.timeline.slides); + // global.update.refreshLiveTimeline.value(); + // global.ready.timeline.set(true); }); - reader.readAsText(file); + reader.readAsArrayBuffer(file); }} />