@volcengine/amk-editor 0.0.5 → 0.0.7-beta.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.
@@ -0,0 +1,17 @@
1
+ import type { AmkEditorVodUploadToken } from './types';
2
+ type VodAction = 'UpdateMediaPublishStatus' | 'GetPlayInfo' | 'GetVideoPlayInfo';
3
+ type VodRequestMethod = 'GET' | 'POST';
4
+ type VodRequestValue = string | number | boolean;
5
+ interface VodRequestOptions {
6
+ method?: VodRequestMethod;
7
+ version?: string;
8
+ }
9
+ /** 与点播 OpenAPI 的 V4 请求签名保持一致,不把长期 AK/SK 带入浏览器。 */
10
+ export declare function signVodOpenApiRequest(token: AmkEditorVodUploadToken, action: VodAction, params: Record<string, VodRequestValue>, now?: Date, options?: VodRequestOptions): Promise<{
11
+ url: string;
12
+ method: VodRequestMethod;
13
+ headers: Record<string, string>;
14
+ body?: string;
15
+ }>;
16
+ export declare function requestVodOpenApi(token: AmkEditorVodUploadToken, action: VodAction, params: Record<string, VodRequestValue>, options?: VodRequestOptions): Promise<Record<string, unknown>>;
17
+ export {};
@@ -0,0 +1,64 @@
1
+ import type { AmkEditorVodPlayInfo, AmkEditorVodUploadConfig, AmkEditorStorageConfig, AmkEditorVodUploadToken, MaterialItem } from './types';
2
+ type STSToken = AmkEditorVodUploadToken;
3
+ type VodFileOption = {
4
+ file: File;
5
+ stsToken: STSToken;
6
+ type: 'media';
7
+ processAction?: Array<{
8
+ name: string;
9
+ input?: unknown;
10
+ }>;
11
+ };
12
+ type InitConfig = {
13
+ appId: number;
14
+ userId: string;
15
+ region: string;
16
+ videoHost: string;
17
+ videoConfig: {
18
+ spaceName: string;
19
+ processAction: Array<{
20
+ Name: 'GetMeta' | 'AddOptionInfo';
21
+ Input?: Record<string, unknown>;
22
+ }>;
23
+ };
24
+ useLocalStorage: boolean;
25
+ useFileExtension: boolean;
26
+ useServerCurrentTime: boolean;
27
+ };
28
+ type SupportedMaterialType = 'video' | 'audio' | 'image';
29
+ type VodUploader = {
30
+ addFile(options: VodFileOption): string;
31
+ once(event: 'complete' | 'error', listener: (info: Record<string, unknown>) => void): void;
32
+ start(key: string): void;
33
+ };
34
+ export interface UploadFileToVodOptions {
35
+ file: File;
36
+ config: AmkEditorVodUploadConfig;
37
+ createUploader?: (config: InitConfig) => VodUploader;
38
+ }
39
+ /** 从统一 storage 配置推导点播上传和播放地址解析,宿主只提供临时凭证。 */
40
+ export declare function createVodConfigFromStorage(storage: AmkEditorStorageConfig, userId: string): AmkEditorVodUploadConfig;
41
+ export declare function extractVodVid(info: unknown): string;
42
+ /** 把 Vid 与播放信息转换为 AMK 工程素材。 */
43
+ export declare function createVodMaterial(input: {
44
+ file: File;
45
+ vid: string;
46
+ type: SupportedMaterialType;
47
+ config: AmkEditorVodUploadConfig;
48
+ playInfo: AmkEditorVodPlayInfo;
49
+ }): MaterialItem;
50
+ /** 使用发行版内置 uploader 将单个本地文件直传 VOD,并换取可播放地址。 */
51
+ export declare function uploadFileToVod(options: UploadFileToVodOptions): Promise<MaterialItem>;
52
+ /** 解析 SDK 保存的 VOD 稳定素材身份。 */
53
+ export declare function parseVodResourceUrl(value: unknown): {
54
+ spaceName: string;
55
+ vid: string;
56
+ } | null;
57
+ /** 使用宿主播放信息回调刷新素材及抽帧产物的临时播放地址。 */
58
+ export declare function refreshVodMaterialUrls(options: {
59
+ materials: MaterialItem[];
60
+ config: AmkEditorVodUploadConfig;
61
+ }): Promise<Array<Partial<MaterialItem> & {
62
+ material_id: string;
63
+ }>>;
64
+ export {};
@@ -1 +1,6 @@
1
- export declare function createIsolatedXgPlayerMount(host: HTMLElement): HTMLDivElement;
1
+ export interface IsolatedXgPlayerMount {
2
+ mount: HTMLDivElement;
3
+ shadowRoot: ShadowRoot;
4
+ }
5
+ export declare function bindIsolatedXgPlayerFullscreen(host: HTMLElement, mount: HTMLElement, shadowRoot: ShadowRoot): () => void;
6
+ export declare function createIsolatedXgPlayerMount(host: HTMLElement): IsolatedXgPlayerMount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/amk-editor",
3
- "version": "0.0.5",
3
+ "version": "0.0.7-beta.7",
4
4
  "description": "AMK scenario editor wrapper for VeVeditor",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -20,16 +20,11 @@
20
20
  "./dist/index.js",
21
21
  "./dist/veveditor.css"
22
22
  ],
23
- "scripts": {
24
- "build": "node scripts/build.mjs && tsc -p tsconfig.json --emitDeclarationOnly",
25
- "prepublishOnly": "pnpm run build",
26
- "test": "vitest run --config vitest.config.ts",
27
- "clean": "rm -rf dist"
28
- },
29
23
  "dependencies": {
30
24
  "@volcengine/tos-sdk": "2.9.0",
31
25
  "react": "18.2.0",
32
26
  "react-dom": "18.2.0",
27
+ "tt-uploader": "1.6.1",
33
28
  "tslib": "^2.6.0",
34
29
  "xgplayer": "2.6.4"
35
30
  },
@@ -44,18 +39,5 @@
44
39
  "react-dom": {
45
40
  "optional": true
46
41
  }
47
- },
48
- "devDependencies": {
49
- "@cloud-materials/common": "1.5.0",
50
- "@types/react": "18.2.79",
51
- "@types/react-dom": "18.2.25",
52
- "@ve-design/react": "0.0.7",
53
- "dayjs": "1.11.10",
54
- "esbuild": "^0.25.0",
55
- "happy-dom": "^20.11.0",
56
- "less": "^4.2.0",
57
- "terser": "^5.46.1",
58
- "typescript": "^5.3.0",
59
- "vitest": "^4.1.10"
60
42
  }
61
43
  }