@volcengine/amk-editor 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.
- package/README.md +114 -2
- package/dist/amk-editor.d.ts +83 -23
- package/dist/api/project.d.ts +13 -1
- package/dist/asr-provider.d.ts +17 -0
- package/dist/byteplus-export-source-adapter.d.ts +9 -0
- package/dist/config-validation.d.ts +3 -0
- package/dist/distribution.d.ts +16 -0
- package/dist/export-project-adapter.d.ts +2 -0
- package/dist/header.d.ts +2 -0
- package/dist/i18n/keys.d.ts +1 -0
- package/dist/import-actions.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +128 -128
- package/dist/legacy-export-adapter.d.ts +7 -0
- package/dist/material-source.d.ts +5 -0
- package/dist/refresh-play-info.d.ts +1 -1
- package/dist/tos-upload.d.ts +7 -0
- package/dist/types.d.ts +105 -18
- package/dist/upload-queue.d.ts +6 -0
- package/dist/utils/signed-media-url-expiration.d.ts +2 -0
- package/dist/veveditor.css +1 -1
- package/dist/vod-openapi.d.ts +17 -0
- package/dist/vod-upload.d.ts +71 -0
- package/dist/xg-player-style-isolation.d.ts +6 -1
- package/package.json +2 -20
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExportVideoParams } from './types';
|
|
2
|
+
type RecordValue = Record<string, any>;
|
|
3
|
+
export declare function buildExportSubmission(editParam: RecordValue, params: Pick<ExportVideoParams, 'resolution' | 'format' | 'frameRate' | 'codec'>, legacy?: boolean): {
|
|
4
|
+
toolName: string;
|
|
5
|
+
params: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import type { MaterialItem } from './types';
|
|
|
4
4
|
* 优先按 SDK 内部 material_id 匹配,随后按业务 source_material_id 兜底;
|
|
5
5
|
* 两个标识都没有的补丁才按数组下标兜底。
|
|
6
6
|
* 可更新 url / poster / sprite / source_material_id 等。
|
|
7
|
-
* material_id
|
|
7
|
+
* material_id 与抽帧任务 ID 由 SDK 维护,补丁中的同名字段会被忽略。
|
|
8
8
|
*/
|
|
9
9
|
export type MaterialPlayInfoPatch = Partial<MaterialItem> & {
|
|
10
10
|
material_id?: string;
|
package/dist/tos-upload.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { AmkEditorStorageConfig, AmkEditorUploadSTSCredentials, MaterialIte
|
|
|
2
2
|
export declare const DEFAULT_TOS_REGION = "cn-beijing";
|
|
3
3
|
export declare const DEFAULT_SIGNED_URL_EXPIRES_SECONDS: number;
|
|
4
4
|
export declare const TOS_SIGNED_URL_REFRESH_AHEAD_MS: number;
|
|
5
|
+
/** 配置隔离的短期凭证缓存;未知有效期仅合并在途请求,不猜测 TTL。 */
|
|
6
|
+
export declare function getCachedTosCredentials(storage: AmkEditorStorageConfig): Promise<AmkEditorUploadSTSCredentials>;
|
|
5
7
|
/** 签名最长 24 小时,但不能超过本次 STS 凭证的剩余有效期。 */
|
|
6
8
|
export declare function resolveSignedUrlExpiresSeconds(credentials: AmkEditorUploadSTSCredentials, now?: number): number;
|
|
7
9
|
/** 解析 TOS V4 签名 URL 的绝对过期时间;非 TOS 签名链返回 null。 */
|
|
@@ -41,6 +43,11 @@ export declare function parseTosResourceUrl(value: unknown): {
|
|
|
41
43
|
bucket: string;
|
|
42
44
|
key: string;
|
|
43
45
|
} | null;
|
|
46
|
+
/** 业务 ID 可独立于存储地址,优先有效 source_material_id,否则使用 source。 */
|
|
47
|
+
export declare function resolveTosMaterialSource(material: {
|
|
48
|
+
source_material_id?: unknown;
|
|
49
|
+
source?: unknown;
|
|
50
|
+
}): string | undefined;
|
|
44
51
|
/** 与素材 TOS 上传保持一致,保留配置的产物存储目录。 */
|
|
45
52
|
export declare function resolveTosOutputDestination(destination: string | undefined): string | undefined;
|
|
46
53
|
/** 使用宿主下发的临时 STS 将本地文件直传客户 TOS,并转换为编辑器素材。 */
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VeVeditorI18nOptions, VeVeditorMaterialItem, VeVeditorOptions, VeVeditorTheme, VeVeditorDecodeOptions } from './public-types';
|
|
1
|
+
import type { VeVeditorI18nOptions, VeVeditorMaterialItem, VeVeditorMaterialOptions, VeVeditorOptions, VeVeditorTheme, VeVeditorDecodeOptions } from './public-types';
|
|
2
2
|
export type Theme = VeVeditorTheme;
|
|
3
3
|
export interface MaterialItem extends VeVeditorMaterialItem {
|
|
4
4
|
/** 业务侧素材主键;上传 / 更新 / 删除必填。 */
|
|
@@ -30,20 +30,27 @@ export interface AmkMaterialImportRequestOptions {
|
|
|
30
30
|
export interface RecommendedExtractStorageFields {
|
|
31
31
|
/** 封面图稳定身份;内置 TOS 链路保存 `tos://bucket/key`。 */
|
|
32
32
|
poster_storage_key?: string;
|
|
33
|
-
/** 与 sprite.storeurls
|
|
33
|
+
/** 与 sprite.storeurls 等长的稳定身份数组;内置链路保存 tos:// 或 vod:// 地址。 */
|
|
34
34
|
sprite_storage_keys?: string[];
|
|
35
35
|
}
|
|
36
36
|
export interface PersistExtractUrlsResult {
|
|
37
37
|
/** 转存后的长期可访问 URL,须与回调入参 urls 等长。 */
|
|
38
38
|
urls: string[];
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
40
|
+
* 随转存结果写回素材的业务字段;material_id、poster_task_id、
|
|
41
|
+
* sprite_task_id 由 SDK 维护,即使传入 null 也会被忽略。
|
|
42
|
+
* 其他字段名和结构由业务决定,SDK 不限制自定义嵌套结构。
|
|
42
43
|
*/
|
|
43
44
|
materialPatch?: Partial<MaterialItem>;
|
|
44
45
|
}
|
|
45
|
-
export interface MaterialConfig {
|
|
46
|
-
|
|
46
|
+
export interface MaterialConfig extends VeVeditorMaterialOptions<MaterialItem> {
|
|
47
|
+
/**
|
|
48
|
+
* 本地单文件上传流程的并发上限(正整数);未配置时保持不限并发。
|
|
49
|
+
* 同一编辑器跨批次共享;覆盖上传、元信息补齐及入库,不含后台抽帧。
|
|
50
|
+
* 适用于 onUploadFile、内置上传和临时 URL 素材转存,不控制旧 onUploadMaterial 的内部并发。
|
|
51
|
+
* 此值不是每秒请求数,也不控制单文件分片并发。
|
|
52
|
+
*/
|
|
53
|
+
uploadConcurrency?: number;
|
|
47
54
|
uploadAccept?: string;
|
|
48
55
|
/** Fires when any material import flow enters or leaves its uploading phase. */
|
|
49
56
|
onUploadStatusChange?: (uploading: boolean) => void;
|
|
@@ -60,11 +67,20 @@ export interface MaterialConfig {
|
|
|
60
67
|
* 返回素材缺少必需元信息时,SDK 同样会在入库前自动探测并补齐。
|
|
61
68
|
*/
|
|
62
69
|
onUploadMaterial?: (files: File[]) => Promise<MaterialItem[]> | MaterialItem[];
|
|
63
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* URL 素材上传回调。普通导入可批量传入;服务端素材标记为 MediaKit 临时存储时,
|
|
72
|
+
* SDK 会跳过播放地址刷新,并按单 URL 调用本回调转存后原位替换 material_id。
|
|
73
|
+
* 临时转存并发数使用 uploadConcurrency,未配置时为 5。
|
|
74
|
+
* 临时地址可先抽帧并展示,抽帧字段等待素材替换成功后再写回客户存储身份。
|
|
75
|
+
* SDK 只扫描初始化已加载的素材和 refreshMaterials() 的结果,不轮询素材列表。
|
|
76
|
+
* 回调只接收 URL 数组;临时素材的类型、名称等元信息由 SDK 从素材库原记录保留。
|
|
77
|
+
*/
|
|
64
78
|
onUploadUrlMaterial?: (urls: string[]) => Promise<MaterialItem[]> | MaterialItem[];
|
|
65
79
|
/**
|
|
66
80
|
* 从业务资产库选择素材。业务方自行实现弹窗、列表查询与勾选,只返回选中数组。
|
|
67
|
-
* `
|
|
81
|
+
* 同时配置 TOS `storage.media_output_destination` 与 `storage.getUploadSTS` 时,
|
|
82
|
+
* `tos://bucket/key` 条目会由 SDK 自动签名和补齐元信息;否则使用业务提供的
|
|
83
|
+
* HTTP(S) 长期地址,缺少地址时交给 `onRefreshPlayInfo` 补齐。
|
|
68
84
|
* 非 TOS 条目缺少必需元信息时,也会使用其 HTTP(S) 地址自动探测并补齐。
|
|
69
85
|
* 返回 `undefined` / `null` / `[]` 视为取消或未选择,不提示失败。
|
|
70
86
|
*/
|
|
@@ -79,16 +95,19 @@ export interface MaterialConfig {
|
|
|
79
95
|
* 配置后:入参为待刷新素材列表,支持批量;返回补丁优先按 material_id 匹配,
|
|
80
96
|
* source_material_id 次之,两者都未返回时才按数组顺序兜底,
|
|
81
97
|
* 返回单条或数组补丁覆盖原素材的播放字段(url / poster / sprite / source_material_id 等)。
|
|
82
|
-
* 补丁不得改写 material_id
|
|
98
|
+
* 补丁不得改写 material_id(服务端字段)及 poster_task_id / sprite_task_id
|
|
99
|
+
*(SDK 抽帧任务状态);即使业务返回 null,也保留 SDK 当前值。
|
|
83
100
|
*/
|
|
84
101
|
onRefreshPlayInfo?: (materials: MaterialItem[]) => Partial<MaterialItem> | Partial<MaterialItem>[] | Promise<Partial<MaterialItem> | Partial<MaterialItem>[]>;
|
|
85
102
|
/**
|
|
86
103
|
* 抽帧得到的临时 http(约 24h)转存成长效地址。
|
|
87
104
|
* SDK 会先用临时链上屏/落盘,再后台调用本回调换链;失败则保留临时链。
|
|
88
|
-
*
|
|
105
|
+
* 未配置时仍会落盘临时 HTTP 链;若同时没有有效的 storage 配置,初始化会提示 warning,不阻止启动。
|
|
106
|
+
* 已存链接下次打开工程时直接复用;加载失败且明确过期时先尝试换链,未恢复则每种素材本会话最多重抽一次。
|
|
89
107
|
* 推荐返回 urls + materialPatch,把刷新 URL 所需的 storage key 或其他业务字段写入素材。
|
|
90
|
-
*
|
|
91
|
-
*
|
|
108
|
+
* materialPatch 可更新其他业务字段,但 material_id、poster_task_id、
|
|
109
|
+
* sprite_task_id 由 SDK 维护,回调返回的值(包括 null)会被忽略。
|
|
110
|
+
* poster_storage_key / sprite_storage_keys 中的 `tos://` 地址会作为后续自动重签依据。
|
|
92
111
|
* 兼容只返回 string[],但该形式无法附带业务字段。
|
|
93
112
|
*/
|
|
94
113
|
onPersistExtractUrls?: (params: {
|
|
@@ -117,6 +136,8 @@ export interface AmkEditorHeaderConfig {
|
|
|
117
136
|
onTitleUpdateSuccess?: (change: AmkEditorHeaderTitleUpdateSuccess) => void;
|
|
118
137
|
}
|
|
119
138
|
export interface AmkEditorExportConfig {
|
|
139
|
+
/** 临时兼容旧 vibe-editing-common 导出;默认 false,后续可移除。 */
|
|
140
|
+
legacy?: boolean;
|
|
120
141
|
/**
|
|
121
142
|
* 导出弹窗是否展示「视频画质增强」。
|
|
122
143
|
* 默认 false(不展示);设为 true 后用户可在弹窗内开关增强。
|
|
@@ -134,26 +155,76 @@ export interface AmkEditorUploadSTSCredentials {
|
|
|
134
155
|
/** 凭证过期时间,支持 ISO 8601、秒时间戳或毫秒时间戳;用于限制签名 URL 有效期。 */
|
|
135
156
|
expiration?: string | number;
|
|
136
157
|
}
|
|
158
|
+
/** 点播 Web 上传及 OpenAPI 发布/播放查询共用的短期 STS 凭证。 */
|
|
159
|
+
export interface AmkEditorVodUploadToken {
|
|
160
|
+
AccessKeyId: string;
|
|
161
|
+
SecretAccessKey: string;
|
|
162
|
+
SessionToken: string;
|
|
163
|
+
ExpiredTime: string;
|
|
164
|
+
CurrentTime: string;
|
|
165
|
+
}
|
|
166
|
+
/** 按 Vid 解析的可播放信息。 */
|
|
167
|
+
export interface AmkEditorVodPlayInfo {
|
|
168
|
+
url: string;
|
|
169
|
+
/** 点播媒资的实际类型;纯音频 MP4 产物也应返回 audio。 */
|
|
170
|
+
mediaType?: 'video' | 'audio';
|
|
171
|
+
poster?: string;
|
|
172
|
+
duration?: number;
|
|
173
|
+
width?: number;
|
|
174
|
+
height?: number;
|
|
175
|
+
}
|
|
176
|
+
/** SDK 内部点播上传与播放地址解析配置,由 storage 目标和临时凭证回调生成。 */
|
|
177
|
+
export interface AmkEditorVodUploadConfig {
|
|
178
|
+
/** 应用云平台分配的 appId,仅用于上传质量监控。 */
|
|
179
|
+
appId: number;
|
|
180
|
+
/** 火山引擎点播空间名。 */
|
|
181
|
+
spaceName: string;
|
|
182
|
+
/** 当前用户稳定标识,用于上传任务隔离与断点续传。 */
|
|
183
|
+
userId: string;
|
|
184
|
+
/** 由宿主服务端签发短期点播 STS。 */
|
|
185
|
+
getUploadToken: () => AmkEditorVodUploadToken | Promise<AmkEditorVodUploadToken>;
|
|
186
|
+
/**
|
|
187
|
+
* 由宿主服务端发布媒资(如需要)并按 Vid 返回 HTTP(S) 播放地址。
|
|
188
|
+
* SDK 会用该回调处理新上传素材、已入库 VOD 素材和 VOD 导出结果的播放地址。
|
|
189
|
+
*/
|
|
190
|
+
getPlayInfo: (vid: string, kind?: 'vid') => AmkEditorVodPlayInfo | Promise<AmkEditorVodPlayInfo>;
|
|
191
|
+
}
|
|
137
192
|
/**
|
|
138
193
|
* 产物 / 主动上传的存储目标。
|
|
139
|
-
* `media_output_destination` 用于
|
|
194
|
+
* `media_output_destination` 用于 SDK 内置上传的目标定位。火山版会默认将其写入会产生媒体产物的
|
|
195
|
+
* AMK tools 请求体以启用产物转存;BytePlus AMK 暂不支持产物转存,因此 BytePlus 构建不会把
|
|
196
|
+
* 该字段发送给 AMK 接口;该配置仍用于内置 BytePlus VOD 上传与播放地址解析,
|
|
197
|
+
* 并作为后续 BytePlus TOS 接入入口。
|
|
140
198
|
* @see https://docs.volcengine.com/docs/6448/2386113
|
|
141
199
|
*/
|
|
142
200
|
export interface AmkEditorStorageConfig {
|
|
143
201
|
/**
|
|
144
202
|
* 处理产物存储目标。支持 `vod://<空间名>` 或 `tos://<桶名>/<可选子目录>`。
|
|
145
203
|
* TOS 本地上传及自动封面/雪碧图产物使用配置的目录,不自动追加项目 ID。
|
|
204
|
+
* 必须与 `getUploadSTS` 同时配置;只配置其中任意一个都会在初始化时报错。
|
|
146
205
|
* 配置后任务结果中的 url 为对应资源地址,而不是临时下载链;当返回
|
|
147
|
-
* `tos://bucket/key`
|
|
206
|
+
* `tos://bucket/key` 或 `vod://space/Vid` 时,SDK 会分别通过 TOS 签名或
|
|
207
|
+
* VOD 播放信息接口换取 HTTP(S) 预览地址。
|
|
148
208
|
*/
|
|
149
209
|
media_output_destination?: string;
|
|
150
210
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
211
|
+
* TOS 目标返回 TOS STS,VOD 目标返回含上传、发布和播放查询权限的短期 STS;
|
|
212
|
+
* 必须与 media_output_destination 同时配置;只配置其中任意一个都会在初始化时报错。
|
|
213
|
+
* SDK 按目标协议选择内置上传与播放地址刷新链路。
|
|
214
|
+
* TOS 凭证按 expiration 缓存至过期前 5 分钟,并合并并发获取;
|
|
215
|
+
* expiration 缺失或无效时只合并在途请求,不缓存已完成的结果。
|
|
216
|
+
* VOD 同样按 ExpiredTime 缓存至过期前 5 分钟并合并并发获取,不缓存播放查询结果。
|
|
217
|
+
* 内置 VOD 通过 GetPlayInfo 请求不超过 STS 剩余时长和 24 小时的播放 URL;
|
|
218
|
+
* 对带 auth_key 到期时间的 URL 在到期前 5 分钟自动刷新,届时按需重新获取 STS。
|
|
219
|
+
* 本地上传优先使用业务配置的 `material.onUploadFile` / `material.onUploadMaterial`;
|
|
220
|
+
* 两者均未配置时,SDK 才按目标协议使用内置 VOD / TOS 上传。
|
|
221
|
+
* 业务服务端应返回最小权限、短有效期凭证,
|
|
154
222
|
* 浏览器端不得保存客户长期 AK/SK。
|
|
223
|
+
* 未同时配置 TOS `media_output_destination` 时,SDK 不会仅凭素材
|
|
224
|
+
* `source_material_id` 或兜底 `source` 的 `tos://` 前缀接管播放地址;业务长期 URL 会原样使用,
|
|
225
|
+
* 缺少 URL 时可由 `material.onRefreshPlayInfo` 补齐。
|
|
155
226
|
*/
|
|
156
|
-
getUploadSTS?: () => AmkEditorUploadSTSCredentials | Promise<AmkEditorUploadSTSCredentials>;
|
|
227
|
+
getUploadSTS?: () => AmkEditorUploadSTSCredentials | AmkEditorVodUploadToken | Promise<AmkEditorUploadSTSCredentials | AmkEditorVodUploadToken>;
|
|
157
228
|
}
|
|
158
229
|
export interface ExportVideoParams {
|
|
159
230
|
videoName: string;
|
|
@@ -230,7 +301,15 @@ export interface VeVeditorInstance {
|
|
|
230
301
|
[key: string]: unknown;
|
|
231
302
|
}
|
|
232
303
|
/** 内置 get/update 工程快照(不导出给宿主配置) */
|
|
304
|
+
/** 工程接口返回的元信息;保留服务端扩展字段,供宿主及后续 UI 使用。 */
|
|
305
|
+
export type AmkProjectInfo = {
|
|
306
|
+
project_id: string;
|
|
307
|
+
name: string;
|
|
308
|
+
description?: string;
|
|
309
|
+
[key: string]: unknown;
|
|
310
|
+
};
|
|
233
311
|
export type AmkProjectSnapshot = {
|
|
312
|
+
projectInfo?: AmkProjectInfo;
|
|
234
313
|
projectName?: string;
|
|
235
314
|
materials?: MaterialItem[];
|
|
236
315
|
editParam?: Record<string, unknown>;
|
|
@@ -249,9 +328,17 @@ export type AmkEditorDecodeOptions = VeVeditorDecodeOptions;
|
|
|
249
328
|
/** 每次 AMK 请求前动态获取、原样透传给 endpoint 的业务请求头。 */
|
|
250
329
|
export type AmkEditorGetHeaders = () => Readonly<Record<string, string>> | undefined | Promise<Readonly<Record<string, string>> | undefined>;
|
|
251
330
|
export interface AmkEditorOptions extends AmkInheritedVeVeditorOptions {
|
|
331
|
+
toolbar?: AmkInheritedVeVeditorOptions['toolbar'] & {
|
|
332
|
+
/** 字幕识别后端:火山默认 asr-subtitles,BytePlus 默认 maas。 */
|
|
333
|
+
asr?: {
|
|
334
|
+
provider?: import('./asr-provider').AmkAsrProvider;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
252
337
|
projectId: string;
|
|
253
338
|
/** AMK Editing API 的业务代理地址。 */
|
|
254
339
|
endpoint: string;
|
|
340
|
+
/** 接入方标识,用于埋点来源和问题归因;缺省时使用 sdk。 */
|
|
341
|
+
source?: string;
|
|
255
342
|
/** 每次请求前调用;返回值不解析、不改写,仅透传给 endpoint。 */
|
|
256
343
|
getHeaders?: AmkEditorGetHeaders;
|
|
257
344
|
header?: AmkEditorHeaderConfig;
|