@vidtreo/recorder 1.3.2 → 1.3.4

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.d.ts CHANGED
@@ -65,6 +65,10 @@ export {};
65
65
 
66
66
  export {};
67
67
 
68
+ export {};
69
+
70
+ export {};
71
+
68
72
  export type VidtreoRecorderConfig = {
69
73
  apiKey: string;
70
74
  apiUrl?: string;
@@ -170,6 +174,7 @@ export declare class UploadQueueManager {
170
174
  private readonly processingIntervalId;
171
175
  private readonly networkOnlineHandler;
172
176
  private isProcessing;
177
+ private hasRecoveredStaleUploads;
173
178
  private retryTimeoutId;
174
179
  private callbacks;
175
180
  constructor(storageService: VideoStorageService, uploadService: VideoUploadService);
package/dist/index.js CHANGED
@@ -1845,7 +1845,8 @@ class VideoStorageService {
1845
1845
  reject(new Error("Upload not found"));
1846
1846
  return;
1847
1847
  }
1848
- const updated = { ...upload, ...updates, updatedAt: Date.now() };
1848
+ const updatedAt = updates.updatedAt !== undefined ? updates.updatedAt : Date.now();
1849
+ const updated = { ...upload, ...updates, updatedAt };
1849
1850
  const putRequest = store.put(updated);
1850
1851
  putRequest.onsuccess = () => resolve();
1851
1852
  putRequest.onerror = () => {
@@ -3908,7 +3909,7 @@ class CameraStreamManager {
3908
3909
  // package.json
3909
3910
  var package_default = {
3910
3911
  name: "@vidtreo/recorder",
3911
- version: "1.3.2",
3912
+ version: "1.3.4",
3912
3913
  type: "module",
3913
3914
  description: "Vidtreo SDK for browser-based video recording and transcoding. Features include camera/screen recording, real-time MP4 transcoding, audio level analysis, mute/pause controls, source switching, device selection, and automatic backend uploads. Similar to Ziggeo and Addpipe, Vidtreo provides enterprise-grade video processing capabilities for web applications.",
3914
3915
  main: "./dist/index.js",
@@ -3957,6 +3958,7 @@ var package_default = {
3957
3958
  devDependencies: {
3958
3959
  "@happy-dom/global-registrator": "^20.6.0",
3959
3960
  "@types/node": "^25.2.3",
3961
+ "fake-indexeddb": "^6.2.5",
3960
3962
  typescript: "^5.9.3",
3961
3963
  vite: "^7.3.1"
3962
3964
  },
@@ -4456,6 +4458,7 @@ class UploadQueueManager {
4456
4458
  processingIntervalId;
4457
4459
  networkOnlineHandler;
4458
4460
  isProcessing = false;
4461
+ hasRecoveredStaleUploads = false;
4459
4462
  retryTimeoutId = null;
4460
4463
  callbacks = {};
4461
4464
  constructor(storageService, uploadService) {
@@ -4485,7 +4488,10 @@ class UploadQueueManager {
4485
4488
  }
4486
4489
  async queueUpload(upload) {
4487
4490
  const id = await this.storageService.savePendingUpload(upload);
4488
- this.processQueue();
4491
+ this.processQueue().catch((error) => {
4492
+ const errorMessage = extractErrorMessage(error);
4493
+ this.callbacks.onUploadError?.(id, new Error(errorMessage));
4494
+ });
4489
4495
  return id;
4490
4496
  }
4491
4497
  async processQueue() {
@@ -4497,6 +4503,13 @@ class UploadQueueManager {
4497
4503
  if (!this.storageService.isInitialized()) {
4498
4504
  throw new Error("Database not initialized");
4499
4505
  }
4506
+ if (!this.hasRecoveredStaleUploads) {
4507
+ const staleUploads = await this.storageService.getPendingUploads("uploading");
4508
+ await Promise.all(staleUploads.map((upload) => this.storageService.updateUploadStatus(upload.id, {
4509
+ status: "pending"
4510
+ })));
4511
+ this.hasRecoveredStaleUploads = true;
4512
+ }
4500
4513
  const pendingUploads = await this.storageService.getPendingUploads("pending");
4501
4514
  if (pendingUploads.length > 0) {
4502
4515
  const upload = this.getOldestUpload(pendingUploads);
@@ -4602,7 +4615,10 @@ class UploadQueueManager {
4602
4615
  this.clearTimer(this.retryTimeoutId, clearTimeout);
4603
4616
  this.retryTimeoutId = window.setTimeout(() => {
4604
4617
  this.retryTimeoutId = null;
4605
- this.processQueue();
4618
+ this.processQueue().catch((error) => {
4619
+ const errorMessage = extractErrorMessage(error);
4620
+ this.callbacks.onUploadError?.("scheduled-retry", new Error(errorMessage));
4621
+ });
4606
4622
  }, delay);
4607
4623
  }
4608
4624
  clearTimer(timerId, clearFn) {
@@ -17640,6 +17656,7 @@ class RecorderController {
17640
17656
  clearTimeout(this.recordingWarmupTimeoutId);
17641
17657
  this.recordingWarmupTimeoutId = null;
17642
17658
  }
17659
+ this.uploadQueueManager?.destroy();
17643
17660
  this.storageManager.destroy();
17644
17661
  this.recordingManager.cleanup();
17645
17662
  this.audioLevelAnalyzer.stopTracking();
@@ -17706,8 +17723,14 @@ class RecorderController {
17706
17723
  this.recordingManager.setTabVisibilityOverlayConfig(this.enableTabVisibilityOverlay, this.tabVisibilityOverlayText);
17707
17724
  }
17708
17725
  async initializeStorage() {
17726
+ if (this.isDestroyed) {
17727
+ return;
17728
+ }
17709
17729
  const onStorageCleanupError = resolveStorageCleanupErrorCallback(this.callbacks);
17710
17730
  await this.storageManager.initialize(onStorageCleanupError);
17731
+ if (this.isDestroyed) {
17732
+ return;
17733
+ }
17711
17734
  const storageService = this.storageManager.getStorageService();
17712
17735
  if (!(storageService && this.uploadService)) {
17713
17736
  return;
@@ -17871,7 +17894,8 @@ function calculateBarColor(position) {
17871
17894
  return `rgb(0, ${Math.round(128 - (100 - 128) * t)}, ${Math.round(128 + (200 - 128) * t)})`;
17872
17895
  }
17873
17896
  // src/core/utils/browser-error-utils.ts
17874
- var ANCHOR_TAG_PATTERN = /<a\s+href="(?<href>[^"]+)"(?:\s+target="(?<target>[^"]+)")?\s*>(?<text>[^<]+)<\/a>/;
17897
+ var ANCHOR_TAG_PATTERN = /<a\s[^>]*href="(?<href>[^"]+)"[^>]*>(?<text>[^<]+)<\/a>/;
17898
+ var TARGET_ATTRIBUTE_PATTERN = /\starget=["'](?<target>[^"']+)["']/;
17875
17899
  var SAFE_PROTOCOL_HTTP = "http:";
17876
17900
  var SAFE_PROTOCOL_HTTPS = "https:";
17877
17901
  var URL_SCHEME_PATTERN = /^[a-zA-Z][a-zA-Z\d+\-.]*:/;
@@ -17975,10 +17999,8 @@ function parseBrowserErrorLinkContent(text) {
17975
17999
  suffix: ""
17976
18000
  };
17977
18001
  }
17978
- let linkTarget = null;
17979
- if (match.groups.target) {
17980
- linkTarget = match.groups.target;
17981
- }
18002
+ const targetMatch = TARGET_ATTRIBUTE_PATTERN.exec(match[0]);
18003
+ const linkTarget = targetMatch?.groups?.target ?? null;
17982
18004
  return {
17983
18005
  prefix,
17984
18006
  linkText: match.groups.text,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidtreo/recorder",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "type": "module",
5
5
  "description": "Vidtreo SDK for browser-based video recording and transcoding. Features include camera/screen recording, real-time MP4 transcoding, audio level analysis, mute/pause controls, source switching, device selection, and automatic backend uploads. Similar to Ziggeo and Addpipe, Vidtreo provides enterprise-grade video processing capabilities for web applications.",
6
6
  "main": "./dist/index.js",
@@ -49,6 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@happy-dom/global-registrator": "^20.6.0",
51
51
  "@types/node": "^25.2.3",
52
+ "fake-indexeddb": "^6.2.5",
52
53
  "typescript": "^5.9.3",
53
54
  "vite": "^7.3.1"
54
55
  },