diff --git a/src/lib/exporter/forwardFrameSource.ts b/src/lib/exporter/forwardFrameSource.ts index eeb9f7e6..c719c62e 100644 --- a/src/lib/exporter/forwardFrameSource.ts +++ b/src/lib/exporter/forwardFrameSource.ts @@ -47,13 +47,17 @@ export class ForwardFrameSource { const url = new URL(resourceUrl); let filePath = decodeURIComponent(url.pathname); if (url.host && url.host !== "localhost") { - return `//${url.host}${filePath}`; + return `\\\\${url.host}${filePath.replace(/\//g, "\\")}`; } if (/^\/[A-Za-z]:/.test(filePath)) { filePath = filePath.slice(1); } return filePath; } catch { + const uncMatch = resourceUrl.match(/^file:\/\/([^/]+)(\/.*)$/i); + if (uncMatch && uncMatch[1].toLowerCase() !== "localhost") { + return `\\\\${uncMatch[1]}${decodeURIComponent(uncMatch[2]).replace(/\//g, "\\")}`; + } return resourceUrl.replace(/^file:\/\//, ""); } } diff --git a/src/lib/exporter/videoExporter.ts b/src/lib/exporter/videoExporter.ts index c81d6c79..a6360a3f 100644 --- a/src/lib/exporter/videoExporter.ts +++ b/src/lib/exporter/videoExporter.ts @@ -565,7 +565,7 @@ export class VideoExporter { if (this.cancelled || !this.nativeExportSessionId) return; const buffer = new ArrayBuffer(chunk.byteLength); chunk.copyTo(buffer); - const writePromise = (this.nativePendingWrite = this.nativePendingWrite + const writePromise = this.nativePendingWrite .then(async () => { const writeResult = await window.electronAPI.nativeVideoExportWriteFrame( sessionId, @@ -586,7 +586,8 @@ export class VideoExporter { this.nativeWriteError = error instanceof Error ? error : new Error(String(error)); } - })); + }); + this.nativePendingWrite = writePromise; this.trackNativeWritePromise(writePromise); }, error: (e) => { @@ -842,7 +843,7 @@ export class VideoExporter { return; } - await oldestWritePromise; + await this.awaitWithFinalizationTimeout(oldestWritePromise, "native frame write"); if (this.nativeWriteError) { throw this.nativeWriteError;