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