@bendyline/squisq-video-react 2.4.23 → 2.4.24

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.
@@ -15,7 +15,7 @@ import {
15
15
  supportsWebCodecs,
16
16
  supportsWebCodecsAac,
17
17
  supportsWebCodecsH264
18
- } from "./chunk-ISYJJJXN.js";
18
+ } from "./chunk-RIXBIX3H.js";
19
19
 
20
20
  // src/hooks/useVideoExport.ts
21
21
  import { useState, useRef, useCallback, useEffect } from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useVideoExport
3
- } from "./chunk-47ODXCBA.js";
3
+ } from "./chunk-BOSF6GLF.js";
4
4
 
5
5
  // src/VideoExportModal.tsx
6
6
  import { useState, useCallback, useEffect, useId, useRef } from "react";
@@ -333,10 +333,21 @@ async function encodeAacTrack(audioBuffer, sink, bitrate) {
333
333
  const sampleRate = audioBuffer.sampleRate;
334
334
  const channels = audioBuffer.numberOfChannels;
335
335
  let encodeError = null;
336
+ let inFlight = 0;
337
+ let wake;
336
338
  const encoder = new AudioEncoder({
337
- output: (chunk, meta) => sink.addAudioChunk(chunk, meta ?? void 0),
339
+ output: (chunk, meta) => {
340
+ inFlight = Math.max(0, inFlight - 1);
341
+ try {
342
+ sink.addAudioChunk(chunk, meta ?? void 0);
343
+ } catch (error) {
344
+ encodeError = error instanceof Error ? error : new Error(String(error));
345
+ }
346
+ wake?.();
347
+ },
338
348
  error: (err) => {
339
349
  encodeError = err instanceof Error ? err : new Error(String(err));
350
+ wake?.();
340
351
  }
341
352
  });
342
353
  encoder.configure({ codec: "mp4a.40.2", sampleRate, numberOfChannels: channels, bitrate });
@@ -352,8 +363,11 @@ async function encodeAacTrack(audioBuffer, sink, bitrate) {
352
363
  try {
353
364
  for (let offset = 0; offset < total; offset += AAC_FRAME_SAMPLES) {
354
365
  if (encodeError) throw encodeError;
355
- if (encoder.encodeQueueSize >= queueLimit) {
356
- await encoder.flush();
366
+ while (inFlight >= queueLimit) {
367
+ await new Promise((resolve) => {
368
+ wake = resolve;
369
+ });
370
+ wake = void 0;
357
371
  if (encodeError) throw encodeError;
358
372
  }
359
373
  const count = Math.min(AAC_FRAME_SAMPLES, total - offset);
@@ -371,6 +385,7 @@ async function encodeAacTrack(audioBuffer, sink, bitrate) {
371
385
  data: planar
372
386
  });
373
387
  try {
388
+ inFlight++;
374
389
  encoder.encode(audioData);
375
390
  } finally {
376
391
  audioData.close();
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  VideoExportButton,
3
3
  VideoExportModal
4
- } from "../chunk-TUZLVOSP.js";
4
+ } from "../chunk-JQLHRJY3.js";
5
5
  import {
6
6
  CoverImageExportModal,
7
7
  coverImageFilename,
8
8
  validateCoverImageDimensions
9
9
  } from "../chunk-JDIMPME5.js";
10
10
  import "../chunk-3NJDHK62.js";
11
- import "../chunk-47ODXCBA.js";
11
+ import "../chunk-BOSF6GLF.js";
12
12
  import "../chunk-A52VG7RA.js";
13
13
  import "../chunk-C7NEHV5X.js";
14
- import "../chunk-ISYJJJXN.js";
14
+ import "../chunk-RIXBIX3H.js";
15
15
  import "../chunk-5MFQMJ5Z.js";
16
16
  export {
17
17
  CoverImageExportModal,
@@ -10,7 +10,7 @@ import {
10
10
  supportsWebCodecs,
11
11
  supportsWebCodecsAac,
12
12
  supportsWebCodecsH264
13
- } from "../chunk-ISYJJJXN.js";
13
+ } from "../chunk-RIXBIX3H.js";
14
14
  import "../chunk-5MFQMJ5Z.js";
15
15
  export {
16
16
  createAudioFileEncoder,
@@ -3,12 +3,12 @@ import {
3
3
  resolveVideoCoverFramePlan,
4
4
  resolveVideoExportCover,
5
5
  useVideoExport
6
- } from "../chunk-47ODXCBA.js";
6
+ } from "../chunk-BOSF6GLF.js";
7
7
  import {
8
8
  useFrameCapture
9
9
  } from "../chunk-A52VG7RA.js";
10
10
  import "../chunk-C7NEHV5X.js";
11
- import "../chunk-ISYJJJXN.js";
11
+ import "../chunk-RIXBIX3H.js";
12
12
  import "../chunk-5MFQMJ5Z.js";
13
13
  export {
14
14
  DEFAULT_VIDEO_COVER_PRE_ROLL_SECONDS,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  VideoExportButton,
3
3
  VideoExportModal
4
- } from "./chunk-TUZLVOSP.js";
4
+ } from "./chunk-JQLHRJY3.js";
5
5
  import {
6
6
  CoverImageExportModal,
7
7
  coverImageFilename,
@@ -13,7 +13,7 @@ import {
13
13
  resolveVideoCoverFramePlan,
14
14
  resolveVideoExportCover,
15
15
  useVideoExport
16
- } from "./chunk-47ODXCBA.js";
16
+ } from "./chunk-BOSF6GLF.js";
17
17
  import {
18
18
  useFrameCapture
19
19
  } from "./chunk-A52VG7RA.js";
@@ -30,7 +30,7 @@ import {
30
30
  supportsWebCodecs,
31
31
  supportsWebCodecsAac,
32
32
  supportsWebCodecsH264
33
- } from "./chunk-ISYJJJXN.js";
33
+ } from "./chunk-RIXBIX3H.js";
34
34
  import {
35
35
  createMediaEditRenderManager,
36
36
  createMediaEditRenderer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-video-react",
3
- "version": "2.4.23",
3
+ "version": "2.4.24",
4
4
  "description": "React components for browser-based MP4 and animated-GIF export of Squisq documents",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -77,9 +77,9 @@
77
77
  "react-dom": "^18.0.0 || ^19.0.0"
78
78
  },
79
79
  "dependencies": {
80
- "@bendyline/squisq": "2.11.17",
81
- "@bendyline/squisq-video": "2.3.21",
82
- "@bendyline/squisq-react": "2.11.19",
80
+ "@bendyline/squisq": "2.11.18",
81
+ "@bendyline/squisq-video": "2.3.22",
82
+ "@bendyline/squisq-react": "2.11.20",
83
83
  "@ffmpeg/core": "0.12.9",
84
84
  "@ffmpeg/ffmpeg": "0.12.15",
85
85
  "@ffmpeg/util": "0.12.2",