@editframe/elements 0.15.0-beta.10 → 0.15.0-beta.11
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/getRenderInfo.d.ts +51 -0
- package/dist/getRenderInfo.js +72 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/package.json +4 -3
- package/types.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RenderInfo: z.ZodObject<{
|
|
3
|
+
width: z.ZodNumber;
|
|
4
|
+
height: z.ZodNumber;
|
|
5
|
+
fps: z.ZodNumber;
|
|
6
|
+
durationMs: z.ZodNumber;
|
|
7
|
+
assets: z.ZodObject<{
|
|
8
|
+
efMedia: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
9
|
+
efCaptions: z.ZodArray<z.ZodString, "many">;
|
|
10
|
+
efImage: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
efMedia: Record<string, any>;
|
|
13
|
+
efCaptions: string[];
|
|
14
|
+
efImage: string[];
|
|
15
|
+
}, {
|
|
16
|
+
efMedia: Record<string, any>;
|
|
17
|
+
efCaptions: string[];
|
|
18
|
+
efImage: string[];
|
|
19
|
+
}>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
fps: number;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
assets: {
|
|
26
|
+
efMedia: Record<string, any>;
|
|
27
|
+
efCaptions: string[];
|
|
28
|
+
efImage: string[];
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
fps: number;
|
|
34
|
+
durationMs: number;
|
|
35
|
+
assets: {
|
|
36
|
+
efMedia: Record<string, any>;
|
|
37
|
+
efCaptions: string[];
|
|
38
|
+
efImage: string[];
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
export declare const getRenderInfo: () => Promise<{
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
fps: number;
|
|
45
|
+
durationMs: number;
|
|
46
|
+
assets: {
|
|
47
|
+
efMedia: Record<string, any>;
|
|
48
|
+
efCaptions: string[];
|
|
49
|
+
efImage: string[];
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const RenderInfo = z.object({
|
|
3
|
+
width: z.number().positive(),
|
|
4
|
+
height: z.number().positive(),
|
|
5
|
+
fps: z.number().positive(),
|
|
6
|
+
durationMs: z.number().positive(),
|
|
7
|
+
assets: z.object({
|
|
8
|
+
efMedia: z.record(z.any()),
|
|
9
|
+
efCaptions: z.array(z.string()),
|
|
10
|
+
efImage: z.array(z.string())
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
const getRenderInfo = async () => {
|
|
14
|
+
const rootTimeGroup = document.querySelector("ef-timegroup");
|
|
15
|
+
if (!rootTimeGroup) {
|
|
16
|
+
throw new Error("No ef-timegroup found");
|
|
17
|
+
}
|
|
18
|
+
console.error("Waiting for media durations", rootTimeGroup);
|
|
19
|
+
await rootTimeGroup.waitForMediaDurations();
|
|
20
|
+
const width = rootTimeGroup.clientWidth;
|
|
21
|
+
const height = rootTimeGroup.clientHeight;
|
|
22
|
+
const fps = 30;
|
|
23
|
+
const durationMs = Math.round(rootTimeGroup.durationMs);
|
|
24
|
+
const elements = document.querySelectorAll(
|
|
25
|
+
"ef-audio, ef-video, ef-image, ef-captions"
|
|
26
|
+
);
|
|
27
|
+
const assets = {
|
|
28
|
+
efMedia: {},
|
|
29
|
+
efCaptions: /* @__PURE__ */ new Set(),
|
|
30
|
+
efImage: /* @__PURE__ */ new Set()
|
|
31
|
+
};
|
|
32
|
+
for (const element of elements) {
|
|
33
|
+
switch (element.tagName) {
|
|
34
|
+
case "EF-AUDIO":
|
|
35
|
+
case "EF-VIDEO": {
|
|
36
|
+
const src = element.src;
|
|
37
|
+
console.error("Processing element", element.tagName, src);
|
|
38
|
+
assets.efMedia[src] = element.trackFragmentIndexLoader.value;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case "EF-IMAGE": {
|
|
42
|
+
const src = element.src;
|
|
43
|
+
console.error("Processing element", element.tagName, src);
|
|
44
|
+
assets.efImage.add(src);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "EF-CAPTIONS": {
|
|
48
|
+
const src = element.targetElement?.src;
|
|
49
|
+
console.error("Processing element", element.tagName, src);
|
|
50
|
+
assets.efCaptions.add(src);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const renderInfo = {
|
|
56
|
+
width,
|
|
57
|
+
height,
|
|
58
|
+
fps,
|
|
59
|
+
durationMs,
|
|
60
|
+
assets: {
|
|
61
|
+
efMedia: assets.efMedia,
|
|
62
|
+
efCaptions: Array.from(assets.efCaptions),
|
|
63
|
+
efImage: Array.from(assets.efImage)
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
console.error("Render info", renderInfo);
|
|
67
|
+
return renderInfo;
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
RenderInfo,
|
|
71
|
+
getRenderInfo
|
|
72
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { EFToggleLoop } from './gui/EFToggleLoop.js';
|
|
|
14
14
|
export { EFScrubber } from './gui/EFScrubber.js';
|
|
15
15
|
export { EFTimeDisplay } from './gui/EFTimeDisplay.js';
|
|
16
16
|
export { EFFocusOverlay } from './gui/EFFocusOverlay.js';
|
|
17
|
+
export { getRenderInfo, RenderInfo } from './getRenderInfo.js';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { EFScrubber } from "./gui/EFScrubber.js";
|
|
|
16
16
|
import { EFTimeDisplay } from "./gui/EFTimeDisplay.js";
|
|
17
17
|
import { EFFocusOverlay } from "./gui/EFFocusOverlay.js";
|
|
18
18
|
import "./EF_FRAMEGEN.js";
|
|
19
|
+
import { RenderInfo, getRenderInfo } from "./getRenderInfo.js";
|
|
19
20
|
if (typeof window !== "undefined") {
|
|
20
21
|
window.EF_REGISTERED = true;
|
|
21
22
|
}
|
|
@@ -38,5 +39,7 @@ export {
|
|
|
38
39
|
EFTogglePlay,
|
|
39
40
|
EFVideo,
|
|
40
41
|
EFWaveform,
|
|
41
|
-
EFWorkbench
|
|
42
|
+
EFWorkbench,
|
|
43
|
+
RenderInfo,
|
|
44
|
+
getRenderInfo
|
|
42
45
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/elements",
|
|
3
|
-
"version": "0.15.0-beta.
|
|
3
|
+
"version": "0.15.0-beta.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
"license": "UNLICENSED",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@bramus/style-observer": "^1.3.0",
|
|
30
|
-
"@editframe/assets": "0.15.0-beta.
|
|
30
|
+
"@editframe/assets": "0.15.0-beta.11",
|
|
31
31
|
"@lit/context": "^1.1.2",
|
|
32
32
|
"@lit/task": "^1.0.1",
|
|
33
33
|
"d3": "^7.9.0",
|
|
34
34
|
"debug": "^4.3.5",
|
|
35
35
|
"lit": "^3.1.4",
|
|
36
|
-
"mp4box": "^0.5.2"
|
|
36
|
+
"mp4box": "^0.5.2",
|
|
37
|
+
"zod": "^3.24.1"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/d3": "^7.4.3",
|