feat: spool media inputs to disk and report producer progress

This commit is contained in:
Levi committed 2026-09-16 23:16:19 +08:00
1 parent e99ef6c7f4
commit e0ced260e2
36 files changed
+1747 -366

No files matched your search

+5 -1
View File
@@ -734,6 +734,8 @@
finishBlobPipeReader(state, true, reason).catch(function () {});
};
const producers = new WeakMap();
globalThis.__gopeed_bind_producer = (stream, id) => producers.set(stream, id);
globalThis.__gopeed_blob_pipe_source = function (openReadable, request, pipeId) {
if (typeof openReadable !== "function") {
throw new TypeError("blob opener must be callable");
@@ -752,6 +754,8 @@
try {
const source = await openReadable(normalizeOpenRequest(request));
state.openSettled = true;
const producer = producers.get(source);
globalThis.__gopeed_blob_pipe_bind(pipeId, producer || "");
state.reader = toReadableStreamReader(source, "gopeed.runtime.blob.createObjectURL opener function");
if (state.cancelRequested) {
await finishBlobPipeReader(state, true, state.cancelReason);
@@ -777,7 +781,7 @@
}
} catch (error) {
if (!state.cancelRequested) {
globalThis.__gopeed_blob_pipe_error(pipeId, error && error.stack ? error.stack : String(error));
globalThis.__gopeed_blob_pipe_error(pipeId, error && (error.stack || error.message) ? (error.stack || error.message) : String(error));
}
} finally {
state.openSettled = true;