Skip to content

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.

Export interruption after a restart in formal wording

Bowen Xue2e5662e80207
diff --git a/web/editor.js b/web/editor.js
index 62fa2b6..995545f 100644
--- a/web/editor.js
+++ b/web/editor.js
@@ -632,7 +632,19 @@ export function openEditor({api, app, from = null, panel = {}, components: given
}
function watchJob(id) {
if (disposed) return;
- if (!jobWatchers.has(id)) jobWatchers.set(id, store.watchChain(id, deliverChain));
+ if (!jobWatchers.has(id)) jobWatchers.set(id, store.watchChain(id, job => job ? deliverChain(job) : chainGone(id)));
+ }
+ // The engine no longer has this job: its unfinished parts stop where they are, as if the engine had dropped them.
+ function chainGone(id) {
+ if (disposed) return false;
+ const previous = jobStatuses.get(id);
+ if (previous) return deliverChain({...previous, state: 'interrupted',
+ blocks: (previous.blocks || []).map(block => ['pending', 'queued', 'running'].includes(block.state) ? {...block, state: 'interrupted'} : block)});
+ jobWatchers.delete(id);
+ const ids = state.record.tracks[0].clips.filter(clip => clip.job === id && ['queued', 'running'].includes(clip.pending)).map(clip => clip.id);
+ if (ids.length) state.settle(record => pinStoppedJob(record, ids, id));
+ updateTop(); updateTransport();
+ return false;
}
function recoverJobs() {
for (const id of new Set(state.record.tracks[0].clips.map(clip => clip.job).filter(Boolean))) watchJob(id);
@@ -1166,7 +1178,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
}
}
},
- watch: (id, fn) => store.watchEars(id, fn),
+ watch: (id, fn, lost) => store.watchEars(id, fn, lost),
cancel: id => store.cancelEars(id),
// Whether speech can be recognised here now, and how many bytes must be downloaded first.
async ability() {
@@ -1179,7 +1191,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
if (install?.state !== 'running') { resolve(install?.state === 'done' || install?.reason || false); return false; }
report(install.total > 0 ? install.done / install.total : 0); return true;
};
- store.installEars().then(value => { if (step(value)) store.watchEarsPack(step); }, reject);
+ store.installEars().then(value => { if (step(value)) store.watchEarsPack(step, reject); }, reject);
}),
cancelDownload: () => store.cancelEarsPack(),
},
@@ -1227,7 +1239,9 @@ export function openEditor({api, app, from = null, panel = {}, components: given
notify(t('Lost the connection to FreeVideo, so the export progress cannot be read. Export again once it is back.', '与 FreeVideo 的连接已断开,无法读取导出进度。恢复后请重新导出。'), EXPORT_ISSUE, 'export:lost');
}
function updateExport(value) {
- if (!value) return false;
+ // A running export the engine no longer knows was lost in a restart: free the button and say so.
+ if (!value) { if (!disposed && exportStatus?.state === 'running') { exportStatus = null; exportCancel.hidden = true; updateTop();
+ notify(t('FreeVideo restarted and the export stopped. Export again.', 'FreeVideo 已重启,导出已中断。请重新导出。'), EXPORT_ISSUE, 'export:gone'); } return false; }
if (exportSnapshot) exportSnapshot = {...exportSnapshot, id: value.project_id, revision: value.revision};
exportStatus = value; const running = value.state === 'running' || value.state === 'queued';
if (disposed) { if (!running) window.FreeVideoNotifyTaskDone?.({kind: 'export', id: value.id, ok: value.state === 'done'}); return running; }
diff --git a/web/editor_store.js b/web/editor_store.js
index 8762297..a3d79ea 100644
--- a/web/editor_store.js
+++ b/web/editor_store.js
@@ -535,13 +535,13 @@ export function createEditorStore(api, {t = en => en, notify = () => {}, onGener
// Subtitles from speech. What this computer can recognise; null where it cannot or the server is older.
async ears() { return (await json('/freevideo/editor/ears'))?.available || null; },
async startEars(id, revision) { return (await json('/freevideo/editor/ears', post({kind: 'transcribe', id, revision})))?.job || null; },
- watchEars(id, fn) { return watch(async () => (await json('/freevideo/editor/ears?' + new URLSearchParams({id})))?.job || null, fn); },
+ watchEars(id, fn, lost) { return watch(async () => (await json('/freevideo/editor/ears?' + new URLSearchParams({id})))?.job || null, fn, lost); },
cancelEars: id => json('/freevideo/editor/ears/cancel', post({id})),
// What recognising speech needs is downloaded on first use; null where the server has no such download.
earsPack: () => json('/freevideo/editor/subtitle-pack'),
installEars: () => json('/freevideo/editor/subtitle-pack', post({action: 'install', language: true})),
cancelEarsPack: () => json('/freevideo/editor/subtitle-pack', post({action: 'cancel'})),
- watchEarsPack(fn) { return watch(() => json('/freevideo/editor/subtitle-pack'), fn); },
+ watchEarsPack(fn, lost) { return watch(() => json('/freevideo/editor/subtitle-pack'), fn, lost); },
// Music for a stretch of the sound track. {available, ready}; null where the server is older.
musicInfo: () => json('/freevideo/editor/music'),
// body: {frames, text?} or {frames, style, mood}, optional seed. Refusals keep the server's reason.
diff --git a/web/editor_text.js b/web/editor_text.js
index df42b3f..fb2fa5d 100644
--- a/web/editor_text.js
+++ b/web/editor_text.js
@@ -105,7 +105,7 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,
if(run!==speech.run){if(job?.id)Promise.resolve(actions.speech.cancel(job.id)).catch(()=>{});return;}
if(!job){speechEnd(speechFailed(),SPEECH_ISSUE);return;}
speech.job=job.id??null;
- if(speechResult(job))speech.stop=actions.speech.watch(job.id,value=>{if(run!==speech.run)return false;if(!value){speechEnd(speechFailed(),SPEECH_ISSUE);return false;}return speechResult(value);});
+ if(speechResult(job))speech.stop=actions.speech.watch(job.id,value=>{if(run!==speech.run)return false;if(!value){speechEnd(speechFailed(),SPEECH_ISSUE);return false;}return speechResult(value);},()=>{if(run===speech.run)speechEnd(speechFailed(),SPEECH_ISSUE);});
}catch{if(run===speech.run)speechEnd(speech.loading?t('Could not download. Try again.','没能下载,请再试一次。'):speechFailed(),SPEECH_ISSUE);}
}
function commitDraft(){if(draft){const change=draft.change;apply(t('Text','文字'),change);const c=selectedText();if(c?.text_kind==='text')lastStyle={...styleOf(state.record,c)};}}
diff --git a/web/studio_chain.js b/web/studio_chain.js
index 0f81278..61bc812 100644
--- a/web/studio_chain.js
+++ b/web/studio_chain.js
@@ -176,7 +176,13 @@ export function createStudioChain({api, node, onState = () => {}, onProgress = (
const id = chain.id, version = epoch;
poller = createPoller(async () => (await json(chainRoute(id)))?.chain || null,
value => version === epoch && !disposed ? deliver(value, fresh) : false,
- {interval: pollMs, clock});
+ // The engine no longer has this chain: stop asking and show it stopped, so Continue is offered.
+ {interval: pollMs, clock, onError: error => {
+ if (error?.status !== 404 || version !== epoch || disposed || chain?.id !== id) return;
+ poller?.dispose();
+ deliver({...chain, state: 'interrupted', joining: false, output_state: chain.output_state === 'joining' ? null : chain.output_state,
+ blocks: (chain.blocks || []).map(block => ['pending', 'queued', 'running'].includes(block.state) ? {...block, state: 'interrupted'} : block)});
+ }});
}
function adopt(value, metadata = null) {
if (chain?.id !== value.id) { epoch++; previous = {}; lastMessage = {}; delivered = errorShown = null; corrected = false; etaAt = 0; lastIndex = -1; }