@glissade/export-web 0.8.1-pre.1 → 0.9.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +21 -8
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,13 @@ interface WebExportOptions {
|
|
|
71
71
|
* transfers the channels (§5.1 worker posture).
|
|
72
72
|
*/
|
|
73
73
|
premixedAudio?: PremixedAudio;
|
|
74
|
+
/**
|
|
75
|
+
* Font validation (§3.6). `true` = strict: an unregistered non-generic family
|
|
76
|
+
* or an uncovered glyph throws before frame 0. Default (false) = dev-warn.
|
|
77
|
+
*/
|
|
78
|
+
strictFonts?: boolean;
|
|
79
|
+
/** OS-installed families to treat as registered for strict mode. */
|
|
80
|
+
osFonts?: ReadonlySet<string>;
|
|
74
81
|
onProgress?: (frame: number, total: number) => void;
|
|
75
82
|
}
|
|
76
83
|
/** Raw mixed audio: one Float32Array per channel, transferable to a Worker. */
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ALL_FORMATS, AudioBufferSource, AudioSample, AudioSampleSource, BlobSource, BufferTarget, CanvasSink, CanvasSource, Input, Mp4OutputFormat, Output, UrlSource, WebMOutputFormat, getFirstEncodableAudioCodec, getFirstEncodableVideoCodec } from "mediabunny";
|
|
2
|
-
import { audioOffsetSamples, compileTimeline, emitDevWarning, sampleTrack } from "@glissade/core";
|
|
3
|
-
import { ColdAssetError, evaluate } from "@glissade/scene";
|
|
2
|
+
import { audioOffsetSamples, buildFontRegistry, compileTimeline, emitDevWarning, sampleTrack } from "@glissade/core";
|
|
3
|
+
import { ColdAssetError, evaluate, validateSceneFonts } from "@glissade/scene";
|
|
4
4
|
import { Canvas2DBackend } from "@glissade/backend-canvas2d";
|
|
5
5
|
//#region src/videoSource.ts
|
|
6
6
|
/**
|
|
@@ -312,12 +312,25 @@ async function exportVideo(scene, doc, opts = {}) {
|
|
|
312
312
|
const backend = new Canvas2DBackend(canvas);
|
|
313
313
|
scene.setTextMeasurer(backend);
|
|
314
314
|
const videoSources = /* @__PURE__ */ new Map();
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
315
|
+
const fontRegistry = buildFontRegistry(doc.assets);
|
|
316
|
+
const g = globalThis;
|
|
317
|
+
const fontSet = g.document?.fonts ?? g.fonts;
|
|
318
|
+
for (const face of fontRegistry.faces()) {
|
|
319
|
+
const fontFace = new FontFace(face.family, `url(${face.url})`, {
|
|
320
|
+
weight: String(face.weight),
|
|
321
|
+
style: face.style
|
|
322
|
+
});
|
|
323
|
+
fontSet?.add(fontFace);
|
|
324
|
+
await fontFace.load();
|
|
325
|
+
}
|
|
326
|
+
await validateSceneFonts(scene, doc, async (url) => {
|
|
327
|
+
const resp = await fetch(url);
|
|
328
|
+
return resp.ok ? await resp.arrayBuffer() : void 0;
|
|
329
|
+
}, {
|
|
330
|
+
mode: opts.strictFonts ? "strict" : "dev",
|
|
331
|
+
...opts.osFonts !== void 0 ? { osFamilies: opts.osFonts } : {}
|
|
332
|
+
});
|
|
333
|
+
for (const [assetId, ref] of Object.entries(doc.assets ?? {})) if (ref.kind === "font") {} else if (ref.kind === "image") {
|
|
321
334
|
const resp = await fetch(ref.url);
|
|
322
335
|
if (!resp.ok) throw new Error(`image asset fetch failed (${resp.status}): ${ref.url}`);
|
|
323
336
|
backend.setImageAsset(assetId, await createImageBitmap(await resp.blob()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/export-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-pre.0",
|
|
4
4
|
"description": "glissade in-browser export: WebCodecs VideoEncoder + Mediabunny muxing, OfflineAudioContext audio mix. Frame-accurate, faster than realtime, no server.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"mediabunny": "^1.0.0",
|
|
19
|
-
"@glissade/backend-canvas2d": "0.
|
|
20
|
-
"@glissade/core": "0.
|
|
21
|
-
"@glissade/scene": "0.
|
|
19
|
+
"@glissade/backend-canvas2d": "0.9.0-pre.0",
|
|
20
|
+
"@glissade/core": "0.9.0-pre.0",
|
|
21
|
+
"@glissade/scene": "0.9.0-pre.0"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|