Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Editor: files dropped on the timeline land where they are dropped
Bowen Xueff01f24de08d
diff --git a/web/editor.js b/web/editor.jsindex 11d9a39..5cc551f 100644--- a/web/editor.js+++ b/web/editor.js@@ -530,6 +530,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given},generationLimits: () => ({maxSeconds: capability.maxSeconds, maxFollowSeconds: capability.maxFollowSeconds}),generationAvailable: () => store.generationAvailable,+ importFiles: (files, options) => library?.importFiles(files, options),gestureStart({selectionGesture = false} = {}) {pointerEditing = true;if (selectionGesture && !menu.hidden) { menu.hidden = true; updateTransport(); }diff --git a/web/editor_library.js b/web/editor_library.jsindex 83b3c61..3b52db3 100644--- a/web/editor_library.js+++ b/web/editor_library.js@@ -165,8 +165,24 @@ export function createEditorLibrary(host, {store, t, actions, state}) {}host.addEventListener('scroll', scheduleMore, {passive: true});const resize = new ResizeObserver(scheduleMore); resize.observe(host);- async function importFiles(files) {+ // Files dropped on the tracks go to the drop point once ready, in drop order.+ const placing = [];+ let placed = Promise.resolve();+ function placeReady(items) {+ while (placing.length && !disposed) {+ const head = placing[0], row = items.find(item => item.id === head.id);+ if (row?.state === 'preparing' || (!row && recentImports.has(head.id))) return;+ placing.shift();+ if (row?.state !== 'ready') continue;+ const value = metadata(row, 'import'), at = head.place.at;+ if (value.hasVideo) head.place.at += value.frames;+ const insert = {source: {kind: 'import', id: row.id}, at, frames: value.frames, hasVideo: value.hasVideo, hasAudio: value.hasAudio};+ placed = placed.then(() => disposed ? null : actions.insertSource(insert, {loadMetadata: true})).catch(actions.error);+ }+ }+ async function importFiles(files, {at} = {}) {choose('import');+ const place = Number.isSafeInteger(at) && at >= 0 ? {at} : null;for (const value of files) {if (disposed) break;const id = 'upload-' + Math.random(), row = {id, name: value.name, kind: value.type.startsWith('audio') ? 'audio' : 'video', state: 'preparing', fraction: 0};@@ -176,6 +192,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {if (item && !disposed) {recentImports.set(item.id, item);imported = [item, ...imported.filter(existing => existing.id !== item.id)];+ if (place) { placing.push({id: item.id, place}); placeReady(imported); }}} catch { actions.notify(t('This file cannot be opened. Supported formats: ', '这个文件打不开。支持的格式:') + FORMATS); }finally { uploading.delete(id); render(); }@@ -186,6 +203,7 @@ export function createEditorLibrary(host, {store, t, actions, state}) {for (const item of items) recentImports.delete(item.id);// A list request started before an upload may finish after it.imported = [...recentImports.values(), ...items]; render();+ placeReady(imported);});const stopUsed = state?.subscribe(event => { if (event.type === 'record') updateUsed(); });render(); load();diff --git a/web/editor_tracks.js b/web/editor_tracks.jsindex f6865ea..4f8b297 100644--- a/web/editor_tracks.js+++ b/web/editor_tracks.js@@ -973,7 +973,18 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions =}return added;}+ const droppingFiles = event => actions.importFiles && !Array.from(event.dataTransfer?.types || []).includes(SOURCE_TYPE)+ && Array.from(event.dataTransfer?.types || []).includes('Files');function dropOver(event) {+ if (droppingFiles(event)) {+ // Files from the computer: only the place is known until they are imported.+ event.preventDefault(); event.stopPropagation(); event.dataTransfer.dropEffect = 'copy';+ const frame = snap(frameAt(event), transportSnapPoints(state, allPoints([]), event), state.zoom);+ const track = state.record.tracks.find(row => row.id === trackAt(event));+ showInsertion(insertionPoint(track?.clips || [], frame.frame).frame); insertion.classList.remove('fv-ed-blocked-insertion');+ showGuide(frame.guide); tooltip.hidden = true;+ return;+ }if (!Array.from(event.dataTransfer?.types || []).includes(SOURCE_TYPE)) return;event.preventDefault(); event.stopPropagation(); event.dataTransfer.dropEffect = 'copy';const frame = snap(frameAt(event), transportSnapPoints(state, allPoints([]), event), state.zoom);@@ -1009,6 +1020,13 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions =}function dropSource(event) {clearSourcePreview();+ if (droppingFiles(event) && event.dataTransfer.files?.length) {+ event.preventDefault(); event.stopPropagation();+ const at = snap(frameAt(event), transportSnapPoints(state, allPoints([]), event), state.zoom).frame;+ actions.importFiles([...event.dataTransfer.files], {at});+ showInsertion(null); showGuide(null); dropPoint = null; dropPreviewKey = '';+ return;+ }const payload = sourcePayload(event.dataTransfer?.getData(SOURCE_TYPE));if (!payload) { showInsertion(null); showGuide(null); return; }event.preventDefault(); event.stopPropagation();