@skippr/live-agent-sdk 0.55.0 → 0.56.0

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.
@@ -2160,8 +2160,9 @@ async function snapToCanvas(element, options = {}) {
2160
2160
  }
2161
2161
 
2162
2162
  // src/components/DomCapture.tsx
2163
- var SNAPSHOT_INTERVAL_MS = 2000;
2163
+ var SNAPSHOT_INTERVAL_MS = 3000;
2164
2164
  var A11Y_PUBLISH_INTERVAL_MS = 2000;
2165
+ var FIRST_SNAPSHOT_DELAY_MS = 400;
2165
2166
  var CAPTURE_PRESET = ScreenSharePresets.h1080fps30;
2166
2167
  var CAPTURE_FPS = CAPTURE_PRESET.encoding.maxFramerate ?? 30;
2167
2168
  var CAPTURE_BITRATE = 4000000;
@@ -2204,7 +2205,7 @@ async function paintViewportSnapshot(canvas, ctx) {
2204
2205
  filter: shouldIncludeInSnapshot,
2205
2206
  filterMode: "remove",
2206
2207
  backgroundColor: "#ffffff",
2207
- fast: true,
2208
+ fast: false,
2208
2209
  dpr
2209
2210
  });
2210
2211
  const sourceX = window.scrollX * dpr;
@@ -2346,14 +2347,23 @@ function DomCapture() {
2346
2347
  tickSnapshot();
2347
2348
  }
2348
2349
  });
2349
- tickSnapshot();
2350
+ let snapshotTimer = null;
2351
+ const scheduleNextSnapshot = (delay) => {
2352
+ if (cancelled)
2353
+ return;
2354
+ snapshotTimer = setTimeout(async () => {
2355
+ await tickSnapshot();
2356
+ scheduleNextSnapshot(SNAPSHOT_INTERVAL_MS);
2357
+ }, delay);
2358
+ };
2359
+ scheduleNextSnapshot(FIRST_SNAPSHOT_DELAY_MS);
2350
2360
  tickA11yPublish();
2351
- const snapshotTimer = setInterval(tickSnapshot, SNAPSHOT_INTERVAL_MS);
2352
2361
  const a11yPublishTimer = setInterval(tickA11yPublish, A11Y_PUBLISH_INTERVAL_MS);
2353
2362
  return () => {
2354
2363
  cancelled = true;
2355
2364
  didStartRef.current = false;
2356
- clearInterval(snapshotTimer);
2365
+ if (snapshotTimer)
2366
+ clearTimeout(snapshotTimer);
2357
2367
  clearInterval(a11yPublishTimer);
2358
2368
  cleanupDomEventListeners();
2359
2369
  unpublishAndStopTrack(localParticipant, videoTrack);