@meframe/server 0.0.6 → 0.0.7

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.
@@ -21,6 +21,7 @@
21
21
  > 可选但强烈建议(生产环境常见需求):
22
22
  >
23
23
  > - **FFmpeg(用于音频后处理兜底)**:当浏览器运行时不支持 AAC 编码时,`@meframe/core` 会跳过音频导出;此时可由 `@meframe/server` 触发 FFmpeg 后处理,把音频混合并 remux 回 MP4。
24
+ > - **自定义字体(用于字幕/文本渲染)**:当你的 `CompositionModel` 使用了非系统字体(或你希望跨环境渲染一致)时,可以在 `exportToStore({ fonts })` 里传入字体列表(`{ family, url }`)。
24
25
 
25
26
  ### 1. 安装依赖
26
27
 
@@ -70,6 +71,15 @@ WebCodecs 等 API 需要 secure/trustworthy origin。`exportToStore({ pageUrl })
70
71
 
71
72
  > 重要:这是运行时能力差异,不是业务代码“参数写错”。在不支持 AAC encode 的环境里,单纯升/降 Chrome 版本通常不可靠;生产上更稳的是启用 FFmpeg 兜底。
72
73
 
74
+ #### 2.5 字体(可选,但字幕/文本强相关)
75
+
76
+ 如果你的工程里存在字幕/文本(caption/text),并且使用了自定义字体(例如 `fontFamily: 'dtjinbu'`),那么你需要确保 Chromium 在导出时能加载到该字体:
77
+
78
+ - 在 `exportToStore({ fonts })` 传入:`[{ family: string, url: string }]`
79
+ - `url` 必须是 **浏览器可直接 fetch 的 URL**
80
+ - 跨域时需要字体资源响应带正确的 CORS(至少允许 runner 页面 origin)
81
+ - `family` 必须与模型里的 `fontFamily`(或你的模板生成的 `fontFamily`)一致,否则会回退到系统字体
82
+
73
83
  ### 3. 用 `@meframe/adapter-medeo`:Draft → `CompositionModelData`
74
84
 
75
85
  `@meframe/server` 不关心你的业务数据长什么样,它只吃 `CompositionModelData`。
@@ -407,6 +417,9 @@ export async function exportMedeoDraftToMp4(input: {
407
417
  exportOptions: { format: 'mp4' },
408
418
  pageUrl,
409
419
  workerPath,
420
+ // 可选:自定义字体(字幕/文本渲染)
421
+ // 注意:url 必须能在 Chromium 里直接 fetch(跨域需 CORS)
422
+ fonts: [{ family: 'dtjinbu', url: 'https://your-cdn/fonts/dtjinbu.ttf' }],
410
423
  key: outputKey,
411
424
  abortSignal,
412
425
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meframe/server",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Server-side exporter for @meframe/core (browser-driven, multipart upload via injected store)",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/index.js",