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