@weni/unnnic-system 2.33.1 → 2.33.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "2.33.1",
3
+ "version": "2.33.2",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -202,7 +202,7 @@ export default {
202
202
  ? blob
203
203
  : window.URL.createObjectURL(blob);
204
204
 
205
- return durationPromisse;
205
+ return durationPromisse.catch(() => 0); // Return 0 if there's an error
206
206
  },
207
207
 
208
208
  // entry point; accessed by external components
@@ -256,7 +256,7 @@ export default {
256
256
  return;
257
257
  }
258
258
  this.audio.currentTime = 0;
259
- this.duration = this.audio.duration;
259
+ this.duration = isNaN(this.audio.duration) ? 0 : this.audio.duration;
260
260
  };
261
261
 
262
262
  this.audio.addEventListener('loadeddata', setDuration);
@@ -273,7 +273,9 @@ export default {
273
273
  this.audio.addEventListener('timeupdate', () => {
274
274
  if (this.status !== 'playing') return;
275
275
 
276
- this.currentTime = this.audio.currentTime;
276
+ this.currentTime = isNaN(this.audio.currentTime)
277
+ ? 0
278
+ : this.audio.currentTime;
277
279
  });
278
280
 
279
281
  this.audio.addEventListener('ended', () => {
@@ -360,6 +362,10 @@ export default {
360
362
  numberToTimeString(time) {
361
363
  const { isRecording } = this;
362
364
 
365
+ if (isNaN(time)) {
366
+ return isRecording ? '00:00:00' : '00:00';
367
+ }
368
+
363
369
  function formatNumber(number, decimals = 2) {
364
370
  return number.toString().padStart(decimals, '0');
365
371
  }