@twick/visualizer 0.15.15 → 0.15.18
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/project.js +13 -13
- package/package.json +8 -8
- package/src/elements/audio.element.tsx +13 -1
- package/src/elements/video.element.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twick/visualizer",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.18",
|
|
4
4
|
"license": "https://github.com/ncounterspecialist/twick/blob/main/LICENSE.md",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "twick editor --projectFile ./src/live.tsx",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@preact/signals": "^1.2.1",
|
|
25
|
-
"@twick/2d": "^0.15.
|
|
26
|
-
"@twick/core": "^0.15.
|
|
27
|
-
"@twick/renderer": "^0.15.
|
|
28
|
-
"@twick/vite-plugin": "^0.15.
|
|
25
|
+
"@twick/2d": "^0.15.18",
|
|
26
|
+
"@twick/core": "^0.15.18",
|
|
27
|
+
"@twick/renderer": "^0.15.18",
|
|
28
|
+
"@twick/vite-plugin": "^0.15.18",
|
|
29
29
|
"date-fns": "^4.1.0",
|
|
30
30
|
"preact": "^10.19.2",
|
|
31
31
|
"crelt": "^1.0.6",
|
|
32
|
-
"@twick/media-utils": "0.15.
|
|
32
|
+
"@twick/media-utils": "0.15.18"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@twick/cli": "^0.15.
|
|
36
|
-
"@twick/ui": "^0.15.
|
|
35
|
+
"@twick/cli": "^0.15.18",
|
|
36
|
+
"@twick/ui": "^0.15.18",
|
|
37
37
|
"typescript": "5.4.2",
|
|
38
38
|
"typedoc": "^0.25.8",
|
|
39
39
|
"typedoc-plugin-markdown": "^3.17.1",
|
|
@@ -69,8 +69,20 @@ export const AudioElement = {
|
|
|
69
69
|
*create({ containerRef, element, view }: ElementParams) {
|
|
70
70
|
const elementRef = createRef<any>();
|
|
71
71
|
yield* waitFor(element?.s);
|
|
72
|
+
const trimStart = element.props?.time ?? 0;
|
|
73
|
+
const playbackRate = element.props?.playbackRate ?? 1;
|
|
74
|
+
// Clip-relative time so audio content starts at 0 when clip starts at element.s.
|
|
75
|
+
const time = (trimStart + (view.globalTime() - element.s)) * playbackRate;
|
|
72
76
|
yield containerRef().add(
|
|
73
|
-
<Audio
|
|
77
|
+
<Audio
|
|
78
|
+
ref={elementRef}
|
|
79
|
+
key={element.id}
|
|
80
|
+
play={true}
|
|
81
|
+
{...element.props}
|
|
82
|
+
time={time}
|
|
83
|
+
clipStart={element.s}
|
|
84
|
+
trimStart={trimStart}
|
|
85
|
+
/>
|
|
74
86
|
);
|
|
75
87
|
yield* waitFor(Math.max(0, element.e - element.s));
|
|
76
88
|
yield elementRef().play(false);
|
|
@@ -229,7 +229,10 @@ export const VideoElement = {
|
|
|
229
229
|
yield* waitFor(element?.s);
|
|
230
230
|
const frameContainerRef = createRef<any>();
|
|
231
231
|
const frameElementRef = createRef<any>();
|
|
232
|
-
|
|
232
|
+
const trimStart = element.props?.time ?? 0;
|
|
233
|
+
const playbackRate = element.props?.playbackRate ?? 1;
|
|
234
|
+
// Clip-relative time so video content starts at 0 when clip starts at element.s.
|
|
235
|
+
const time = (trimStart + (view.globalTime() - element.s)) * playbackRate;
|
|
233
236
|
yield containerRef().add(
|
|
234
237
|
<Rect ref={frameContainerRef} key={element.id} {...element.frame}>
|
|
235
238
|
<Video
|
|
@@ -237,6 +240,9 @@ export const VideoElement = {
|
|
|
237
240
|
key={`child-${element.id}`}
|
|
238
241
|
play={true}
|
|
239
242
|
{...element.props}
|
|
243
|
+
time={time}
|
|
244
|
+
clipStart={element.s}
|
|
245
|
+
trimStart={trimStart}
|
|
240
246
|
/>
|
|
241
247
|
</Rect>
|
|
242
248
|
);
|