@shotstack/shotstack-canvas 2.0.11 → 2.0.12

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.
@@ -618,6 +618,7 @@ var richCaptionAssetSchema = import_zod.z.object({
618
618
  align: canvasAlignmentSchema.optional(),
619
619
  active: richCaptionActiveSchema.optional(),
620
620
  wordAnimation: richCaptionWordAnimationSchema.optional(),
621
+ pauseThreshold: import_zod.z.number().min(0).default(500).optional(),
621
622
  customFonts: import_zod.z.array(customFontSchema).optional()
622
623
  }).superRefine((data, ctx) => {
623
624
  if (!data.src && !data.words) {
@@ -5760,7 +5761,19 @@ var NodeRawEncoder = class _NodeRawEncoder {
5760
5761
  this.ffmpegProcess.on("error", (err) => {
5761
5762
  this.ffmpegError = err;
5762
5763
  });
5763
- this.ffmpegProcess.stderr?.on("data", () => {
5764
+ let stderrOutput = "";
5765
+ this.ffmpegProcess.stderr?.on("data", (data) => {
5766
+ stderrOutput += data.toString();
5767
+ });
5768
+ this.ffmpegProcess.on("close", (code) => {
5769
+ if (code !== 0 && stderrOutput) {
5770
+ this.ffmpegError = new Error(`FFmpeg exited with code ${code}: ${stderrOutput.slice(-500)}`);
5771
+ }
5772
+ });
5773
+ this.ffmpegProcess.stdin?.on("error", (err) => {
5774
+ if (!this.ffmpegError) {
5775
+ this.ffmpegError = new Error(`FFmpeg stdin error: ${err.message}. stderr: ${stderrOutput.slice(-500)}`);
5776
+ }
5764
5777
  });
5765
5778
  }
5766
5779
  async encodeFrame(frameData, _frameIndex) {
@@ -5975,7 +5988,7 @@ var RichCaptionRenderer = class {
5975
5988
  wordSpacing: typeof style?.wordSpacing === "number" ? style.wordSpacing : 0,
5976
5989
  lineHeight,
5977
5990
  textTransform: style?.textTransform ?? "none",
5978
- pauseThreshold: 500,
5991
+ pauseThreshold: this.currentAsset?.pauseThreshold ?? 500,
5979
5992
  measureTextWidth
5980
5993
  };
5981
5994
  this.currentLayout = await this.layoutEngine.layoutCaption(words, layoutConfig);
@@ -372,6 +372,7 @@ declare const richCaptionAssetSchema: z.ZodObject<{
372
372
  down: "down";
373
373
  }>>;
374
374
  }, z.core.$strict>>;
375
+ pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
375
376
  customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
376
377
  src: z.ZodString;
377
378
  family: z.ZodString;
@@ -497,6 +498,7 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
497
498
  down: "down";
498
499
  }>>;
499
500
  }, z.core.$strict>>;
501
+ pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
500
502
  customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
501
503
  src: z.ZodString;
502
504
  family: z.ZodString;
@@ -372,6 +372,7 @@ declare const richCaptionAssetSchema: z.ZodObject<{
372
372
  down: "down";
373
373
  }>>;
374
374
  }, z.core.$strict>>;
375
+ pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
375
376
  customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
376
377
  src: z.ZodString;
377
378
  family: z.ZodString;
@@ -497,6 +498,7 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
497
498
  down: "down";
498
499
  }>>;
499
500
  }, z.core.$strict>>;
501
+ pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
500
502
  customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
501
503
  src: z.ZodString;
502
504
  family: z.ZodString;
@@ -222,6 +222,7 @@ var richCaptionAssetSchema = z.object({
222
222
  align: canvasAlignmentSchema.optional(),
223
223
  active: richCaptionActiveSchema.optional(),
224
224
  wordAnimation: richCaptionWordAnimationSchema.optional(),
225
+ pauseThreshold: z.number().min(0).default(500).optional(),
225
226
  customFonts: z.array(customFontSchema).optional()
226
227
  }).superRefine((data, ctx) => {
227
228
  if (!data.src && !data.words) {
@@ -5363,7 +5364,19 @@ var NodeRawEncoder = class _NodeRawEncoder {
5363
5364
  this.ffmpegProcess.on("error", (err) => {
5364
5365
  this.ffmpegError = err;
5365
5366
  });
5366
- this.ffmpegProcess.stderr?.on("data", () => {
5367
+ let stderrOutput = "";
5368
+ this.ffmpegProcess.stderr?.on("data", (data) => {
5369
+ stderrOutput += data.toString();
5370
+ });
5371
+ this.ffmpegProcess.on("close", (code) => {
5372
+ if (code !== 0 && stderrOutput) {
5373
+ this.ffmpegError = new Error(`FFmpeg exited with code ${code}: ${stderrOutput.slice(-500)}`);
5374
+ }
5375
+ });
5376
+ this.ffmpegProcess.stdin?.on("error", (err) => {
5377
+ if (!this.ffmpegError) {
5378
+ this.ffmpegError = new Error(`FFmpeg stdin error: ${err.message}. stderr: ${stderrOutput.slice(-500)}`);
5379
+ }
5367
5380
  });
5368
5381
  }
5369
5382
  async encodeFrame(frameData, _frameIndex) {
@@ -5578,7 +5591,7 @@ var RichCaptionRenderer = class {
5578
5591
  wordSpacing: typeof style?.wordSpacing === "number" ? style.wordSpacing : 0,
5579
5592
  lineHeight,
5580
5593
  textTransform: style?.textTransform ?? "none",
5581
- pauseThreshold: 500,
5594
+ pauseThreshold: this.currentAsset?.pauseThreshold ?? 500,
5582
5595
  measureTextWidth
5583
5596
  };
5584
5597
  this.currentLayout = await this.layoutEngine.layoutCaption(words, layoutConfig);
@@ -372,6 +372,7 @@ declare const richCaptionAssetSchema: z.ZodObject<{
372
372
  down: "down";
373
373
  }>>;
374
374
  }, z.core.$strict>>;
375
+ pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
375
376
  customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
376
377
  src: z.ZodString;
377
378
  family: z.ZodString;
@@ -497,6 +498,7 @@ declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
497
498
  down: "down";
498
499
  }>>;
499
500
  }, z.core.$strict>>;
501
+ pauseThreshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
500
502
  customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
501
503
  src: z.ZodString;
502
504
  family: z.ZodString;
package/dist/entry.web.js CHANGED
@@ -18100,6 +18100,7 @@ var richCaptionAssetSchema = external_exports.object({
18100
18100
  align: canvasAlignmentSchema.optional(),
18101
18101
  active: richCaptionActiveSchema.optional(),
18102
18102
  wordAnimation: richCaptionWordAnimationSchema.optional(),
18103
+ pauseThreshold: external_exports.number().min(0).default(500).optional(),
18103
18104
  customFonts: external_exports.array(customFontSchema).optional()
18104
18105
  }).superRefine((data, ctx) => {
18105
18106
  if (!data.src && !data.words) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "Text layout & animation engine (HarfBuzz) for Node & Web - fully self-contained.",
5
5
  "type": "module",
6
6
  "main": "./dist/entry.node.cjs",