@twick/video-editor 0.15.16 → 0.15.19
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/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -9187,10 +9187,12 @@ const usePlayerManager = ({
|
|
|
9187
9187
|
changeLog,
|
|
9188
9188
|
videoResolution
|
|
9189
9189
|
} = useTimelineContext();
|
|
9190
|
-
const { getCurrentTime } = useLivePlayerContext();
|
|
9190
|
+
const { getCurrentTime, setSeekTime } = useLivePlayerContext();
|
|
9191
9191
|
const currentChangeLog = useRef(changeLog);
|
|
9192
9192
|
const prevSeekTime = useRef(0);
|
|
9193
9193
|
const [playerUpdating, setPlayerUpdating] = useState(false);
|
|
9194
|
+
const updateCanvasRef = useRef(() => {
|
|
9195
|
+
});
|
|
9194
9196
|
const handleCanvasReady = (_canvas) => {
|
|
9195
9197
|
};
|
|
9196
9198
|
const handleCanvasOperation = (operation, data) => {
|
|
@@ -9226,13 +9228,14 @@ const usePlayerManager = ({
|
|
|
9226
9228
|
}
|
|
9227
9229
|
editor.reorderTracks(reordered);
|
|
9228
9230
|
currentChangeLog.current = currentChangeLog.current + 1;
|
|
9231
|
+
updateCanvasRef.current(getCurrentTime(), true);
|
|
9229
9232
|
return;
|
|
9230
9233
|
}
|
|
9231
9234
|
if (operation === CANVAS_OPERATIONS.CAPTION_PROPS_UPDATED) {
|
|
9232
9235
|
const captionsTrack = editor.getCaptionsTrack();
|
|
9233
9236
|
captionsTrack == null ? void 0 : captionsTrack.setProps(data.props);
|
|
9234
|
-
setSelectedItem(data.element);
|
|
9235
9237
|
editor.refresh();
|
|
9238
|
+
updateCanvasRef.current(getCurrentTime(), true);
|
|
9236
9239
|
} else if (operation === CANVAS_OPERATIONS.WATERMARK_UPDATED) {
|
|
9237
9240
|
const w2 = editor.getWatermark();
|
|
9238
9241
|
if (w2 && data) {
|
|
@@ -9243,6 +9246,7 @@ const usePlayerManager = ({
|
|
|
9243
9246
|
editor.setWatermark(w2);
|
|
9244
9247
|
currentChangeLog.current = currentChangeLog.current + 1;
|
|
9245
9248
|
}
|
|
9249
|
+
updateCanvasRef.current(getCurrentTime(), true);
|
|
9246
9250
|
} else {
|
|
9247
9251
|
const element = ElementDeserializer.fromJSON(data);
|
|
9248
9252
|
switch (operation) {
|
|
@@ -9254,6 +9258,7 @@ const usePlayerManager = ({
|
|
|
9254
9258
|
const updatedElement = editor.updateElement(element);
|
|
9255
9259
|
currentChangeLog.current = currentChangeLog.current + 1;
|
|
9256
9260
|
setSelectedItem(updatedElement);
|
|
9261
|
+
updateCanvasRef.current(getCurrentTime(), true);
|
|
9257
9262
|
}
|
|
9258
9263
|
break;
|
|
9259
9264
|
}
|
|
@@ -9271,13 +9276,15 @@ const usePlayerManager = ({
|
|
|
9271
9276
|
setSelectedItem(element);
|
|
9272
9277
|
currentChangeLog.current = currentChangeLog.current + 1;
|
|
9273
9278
|
editor.refresh();
|
|
9279
|
+
setSeekTime(currentTime);
|
|
9280
|
+
updateCanvasRef.current(currentTime, true);
|
|
9274
9281
|
handleCanvasOperation(CANVAS_OPERATIONS.ADDED_NEW_ELEMENT, {
|
|
9275
9282
|
element,
|
|
9276
9283
|
canvasPosition: canvasX != null && canvasY != null ? { x: canvasX, y: canvasY } : void 0
|
|
9277
9284
|
});
|
|
9278
9285
|
}
|
|
9279
9286
|
},
|
|
9280
|
-
[editor, videoResolution, getCurrentTime, setSelectedItem]
|
|
9287
|
+
[editor, videoResolution, getCurrentTime, setSelectedItem, setSeekTime]
|
|
9281
9288
|
);
|
|
9282
9289
|
const {
|
|
9283
9290
|
twickCanvas,
|
|
@@ -9336,6 +9343,7 @@ const usePlayerManager = ({
|
|
|
9336
9343
|
});
|
|
9337
9344
|
currentChangeLog.current = changeLog;
|
|
9338
9345
|
};
|
|
9346
|
+
updateCanvasRef.current = updateCanvas;
|
|
9339
9347
|
const onPlayerUpdate = (event) => {
|
|
9340
9348
|
var _a;
|
|
9341
9349
|
if (((_a = event == null ? void 0 : event.detail) == null ? void 0 : _a.status) === "ready") {
|
|
@@ -19463,15 +19471,6 @@ const useTimelineManager = () => {
|
|
|
19463
19471
|
for (const el of elements) {
|
|
19464
19472
|
const newStart = el.getStart() + clampedDelta;
|
|
19465
19473
|
const newEnd = el.getEnd() + clampedDelta;
|
|
19466
|
-
if (el instanceof VideoElement$1 || el instanceof AudioElement) {
|
|
19467
|
-
const elementProps = el.getProps();
|
|
19468
|
-
const startDelta = newStart - el.getStart() * ((elementProps == null ? void 0 : elementProps.playbackRate) || 1);
|
|
19469
|
-
if (el instanceof AudioElement) {
|
|
19470
|
-
el.setStartAt(el.getStartAt() + startDelta);
|
|
19471
|
-
} else {
|
|
19472
|
-
el.setStartAt(el.getStartAt() + startDelta);
|
|
19473
|
-
}
|
|
19474
|
-
}
|
|
19475
19474
|
el.setStart(newStart);
|
|
19476
19475
|
el.setEnd(newEnd);
|
|
19477
19476
|
editor.updateElement(el);
|