asciify-engine 1.0.56 → 1.0.57
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.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1284,9 +1284,13 @@ async function asciifyVideo(source, canvas, { fontSize = 10, artStyle = "classic
|
|
|
1284
1284
|
});
|
|
1285
1285
|
}
|
|
1286
1286
|
let timeupdateHandler = null;
|
|
1287
|
-
if (trimEnd !== void 0) {
|
|
1287
|
+
if (trimStart > 0 || trimEnd !== void 0) {
|
|
1288
1288
|
timeupdateHandler = () => {
|
|
1289
|
-
if (video.currentTime >= trimEnd)
|
|
1289
|
+
if (trimEnd !== void 0 && video.currentTime >= trimEnd) {
|
|
1290
|
+
video.currentTime = trimStart;
|
|
1291
|
+
} else if (trimStart > 0 && video.currentTime < trimStart) {
|
|
1292
|
+
video.currentTime = trimStart;
|
|
1293
|
+
}
|
|
1290
1294
|
};
|
|
1291
1295
|
video.addEventListener("timeupdate", timeupdateHandler);
|
|
1292
1296
|
}
|
|
@@ -1304,6 +1308,8 @@ async function asciifyVideo(source, canvas, { fontSize = 10, artStyle = "classic
|
|
|
1304
1308
|
if (cancelled) return;
|
|
1305
1309
|
animId = requestAnimationFrame(tick);
|
|
1306
1310
|
if (video.readyState < 2 || canvas.width === 0 || canvas.height === 0) return;
|
|
1311
|
+
if (trimStart > 0 && video.currentTime < trimStart) return;
|
|
1312
|
+
if (trimEnd !== void 0 && video.currentTime >= trimEnd) return;
|
|
1307
1313
|
const { frame } = imageToAsciiFrame(video, merged, canvas.width, canvas.height);
|
|
1308
1314
|
if (frame.length > 0) {
|
|
1309
1315
|
renderFrameToCanvas(ctx, frame, merged, canvas.width, canvas.height, 0, null);
|