videomail-client 15.7.7 → 15.7.8

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.
@@ -7045,7 +7045,7 @@ var __webpack_modules__ = {
7045
7045
  const safeStringify = __webpack_require__("X");
7046
7046
  const qs = __webpack_require__("b");
7047
7047
  const RequestBase = __webpack_require__("d");
7048
- const { isObject, mixin, hasOwn } = __webpack_require__("Dp");
7048
+ const { isObject, mixin, hasOwn, isSafeKey } = __webpack_require__("Dp");
7049
7049
  const ResponseBase = __webpack_require__("e");
7050
7050
  const Agent = __webpack_require__("pf");
7051
7051
  function noop() {}
@@ -7099,12 +7099,18 @@ var __webpack_modules__ = {
7099
7099
  form: 'application/x-www-form-urlencoded',
7100
7100
  'form-data': 'application/x-www-form-urlencoded'
7101
7101
  };
7102
+ function lookupType(type) {
7103
+ return hasOwn(request.types, type) && request.types[type] || type;
7104
+ }
7102
7105
  request.serialize = {
7103
- 'application/x-www-form-urlencoded': (obj)=>qs.stringify(obj, {
7106
+ 'application/x-www-form-urlencoded' (object) {
7107
+ return qs.stringify(object, {
7104
7108
  indices: false,
7105
7109
  strictNullHandling: true
7106
- }),
7107
- 'application/json': safeStringify
7110
+ });
7111
+ },
7112
+ 'application/json': safeStringify,
7113
+ 'application/csp-report': safeStringify
7108
7114
  };
7109
7115
  request.parse = {
7110
7116
  'application/x-www-form-urlencoded': parseString,
@@ -7122,8 +7128,10 @@ var __webpack_modules__ = {
7122
7128
  index = line.indexOf(':');
7123
7129
  if (-1 !== index) {
7124
7130
  field = line.slice(0, index).toLowerCase();
7125
- value = trim(line.slice(index + 1));
7126
- fields[field] = value;
7131
+ if (isSafeKey(field)) {
7132
+ value = trim(line.slice(index + 1));
7133
+ fields[field] = value;
7134
+ }
7127
7135
  }
7128
7136
  }
7129
7137
  return fields;
@@ -7144,11 +7152,12 @@ var __webpack_modules__ = {
7144
7152
  this.header['content-type'] = this.xhr.getResponseHeader('content-type');
7145
7153
  this._setHeaderProperties(this.header);
7146
7154
  if (null === this.text && request_._responseType) this.body = this.xhr.response;
7147
- else this.body = 'HEAD' === this.req.method ? null : this._parseBody(this.text ? this.text : this.xhr.response);
7155
+ else if ('HEAD' === this.req.method) this.body = null;
7156
+ else this.body = this._parseBody(this.text || this.xhr.response);
7148
7157
  }
7149
7158
  mixin(Response.prototype, ResponseBase.prototype);
7150
7159
  Response.prototype._parseBody = function(string_) {
7151
- let parse = request.parse[this.type];
7160
+ let parse = hasOwn(request.parse, this.type) ? request.parse[this.type] : void 0;
7152
7161
  if (this.req._parser) return this.req._parser(this, string_);
7153
7162
  if (!parse && isJSON(this.type)) parse = request.parse['application/json'];
7154
7163
  return parse && string_ && (string_.length > 0 || string_ instanceof Object) ? parse(string_) : null;
@@ -7183,7 +7192,7 @@ var __webpack_modules__ = {
7183
7192
  error.original = err;
7184
7193
  if (self1.xhr) {
7185
7194
  error.rawResponse = void 0 === self1.xhr.responseType ? self1.xhr.responseText : self1.xhr.response;
7186
- error.status = self1.xhr.status ? self1.xhr.status : null;
7195
+ error.status = self1.xhr.status || null;
7187
7196
  error.statusCode = error.status;
7188
7197
  } else {
7189
7198
  error.rawResponse = null;
@@ -7209,11 +7218,11 @@ var __webpack_modules__ = {
7209
7218
  Emitter(Request.prototype);
7210
7219
  mixin(Request.prototype, RequestBase.prototype);
7211
7220
  Request.prototype.type = function(type) {
7212
- this.set('Content-Type', request.types[type] || type);
7221
+ this.set('Content-Type', lookupType(type));
7213
7222
  return this;
7214
7223
  };
7215
7224
  Request.prototype.accept = function(type) {
7216
- this.set('Accept', request.types[type] || type);
7225
+ this.set('Accept', lookupType(type));
7217
7226
  return this;
7218
7227
  };
7219
7228
  Request.prototype.auth = function(user, pass, options) {
@@ -7225,7 +7234,8 @@ var __webpack_modules__ = {
7225
7234
  if (!options) options = {
7226
7235
  type: 'function' == typeof btoa ? 'basic' : 'auto'
7227
7236
  };
7228
- const encoder = options.encoder ? options.encoder : (string)=>{
7237
+ let { encoder } = options;
7238
+ if (!encoder) encoder = (string)=>{
7229
7239
  if ('function' == typeof btoa) return btoa(string);
7230
7240
  throw new Error('Cannot use basic auth, btoa is not a function');
7231
7241
  };
@@ -7336,16 +7346,24 @@ var __webpack_modules__ = {
7336
7346
  if (this._withCredentials) xhr.withCredentials = true;
7337
7347
  if (!this._formData && 'GET' !== this.method && 'HEAD' !== this.method && 'string' != typeof data && !this._isHost(data)) {
7338
7348
  const contentType = this._header['content-type'];
7339
- let serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
7349
+ const serializeType = contentType ? contentType.split(';')[0] : '';
7350
+ let serialize = this._serializer || (hasOwn(request.serialize, serializeType) ? request.serialize[serializeType] : void 0);
7340
7351
  if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];
7341
7352
  if (serialize) data = serialize(data);
7342
7353
  }
7343
- for(const field in this.header)if (null !== this.header[field]) {
7344
- if (hasOwn(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
7354
+ try {
7355
+ for(const field in this.header)if (null !== this.header[field]) {
7356
+ if (hasOwn(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
7357
+ }
7358
+ if (this._responseType) xhr.responseType = this._responseType;
7359
+ this.emit('request', this);
7360
+ xhr.send(void 0 === data ? null : data);
7361
+ } catch (err) {
7362
+ try {
7363
+ xhr.abort();
7364
+ } catch (err) {}
7365
+ return this.callback(err);
7345
7366
  }
7346
- if (this._responseType) xhr.responseType = this._responseType;
7347
- this.emit('request', this);
7348
- xhr.send(void 0 === data ? null : data);
7349
7367
  };
7350
7368
  const proxyAgent = new Proxy(Agent, {
7351
7369
  apply (target, thisArg, argumentsList) {
@@ -7355,6 +7373,7 @@ var __webpack_modules__ = {
7355
7373
  request.agent = proxyAgent;
7356
7374
  for (const method of [
7357
7375
  'GET',
7376
+ 'HEAD',
7358
7377
  'POST',
7359
7378
  'OPTIONS',
7360
7379
  'PATCH',
@@ -7442,7 +7461,7 @@ var __webpack_modules__ = {
7442
7461
  },
7443
7462
  d (module, __unused_rspack_exports, __webpack_require__) {
7444
7463
  "use strict";
7445
- const { isObject, hasOwn } = __webpack_require__("Dp");
7464
+ const { isObject, hasOwn, isSafeKey } = __webpack_require__("Dp");
7446
7465
  module.exports = RequestBase;
7447
7466
  function RequestBase() {}
7448
7467
  RequestBase.prototype.clearTimeout = function() {
@@ -7552,7 +7571,7 @@ var __webpack_modules__ = {
7552
7571
  if (this._endCalled) console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
7553
7572
  this._fullfilledPromise = new Promise((resolve, reject)=>{
7554
7573
  self1.on('abort', ()=>{
7555
- if (this._maxRetries && this._maxRetries > this._retries) return;
7574
+ if (this.timedout && this._maxRetries && this._maxRetries > this._retries) return;
7556
7575
  if (this.timedout && this.timedoutError) return void reject(this.timedoutError);
7557
7576
  const error = new Error('Aborted');
7558
7577
  error.code = 'ABORTED';
@@ -7679,7 +7698,13 @@ var __webpack_modules__ = {
7679
7698
  } else if (data && this._data && this._isHost(this._data)) throw new Error("Can't merge these send calls");
7680
7699
  if (isObject_ && isObject(this._data)) for(const key in data){
7681
7700
  if ('bigint' == typeof data[key] && !data[key].toJSON) throw new Error('Cannot serialize BigInt value to json');
7682
- if (hasOwn(data, key)) this._data[key] = data[key];
7701
+ if (hasOwn(data, key)) if (isSafeKey(key)) this._data[key] = data[key];
7702
+ else Object.defineProperty(this._data, key, {
7703
+ value: data[key],
7704
+ enumerable: true,
7705
+ writable: true,
7706
+ configurable: true
7707
+ });
7683
7708
  }
7684
7709
  else if ('bigint' == typeof data) throw new Error("Cannot send value of type BigInt");
7685
7710
  else if ('string' == typeof data) {
@@ -7747,7 +7772,7 @@ var __webpack_modules__ = {
7747
7772
  const ct = header['content-type'] || '';
7748
7773
  this.type = utils.type(ct);
7749
7774
  const parameters = utils.params(ct);
7750
- for(const key in parameters)if (Object.prototype.hasOwnProperty.call(parameters, key)) this[key] = parameters[key];
7775
+ for(const key in parameters)if (Object.prototype.hasOwnProperty.call(parameters, key) && !(key in this)) this[key] = parameters[key];
7751
7776
  this.links = {};
7752
7777
  try {
7753
7778
  if (header.link) this.links = utils.parseLinks(header.link);
@@ -7778,13 +7803,19 @@ var __webpack_modules__ = {
7778
7803
  Dp (__unused_rspack_module, exports1) {
7779
7804
  "use strict";
7780
7805
  exports1.type = (string_)=>string_.split(/ *; */).shift();
7806
+ const UNSAFE_KEYS = new Set([
7807
+ '__proto__',
7808
+ 'constructor',
7809
+ 'prototype'
7810
+ ]);
7811
+ exports1.isSafeKey = (key)=>!UNSAFE_KEYS.has(key);
7781
7812
  exports1.params = (value)=>{
7782
7813
  const object = {};
7783
7814
  for (const string_ of value.split(/ *; */)){
7784
7815
  const parts = string_.split(/ *= */);
7785
7816
  const key = parts.shift();
7786
7817
  const value = parts.shift();
7787
- if (key && value) object[key] = value;
7818
+ if (key && value && exports1.isSafeKey(key)) object[key] = value;
7788
7819
  }
7789
7820
  return object;
7790
7821
  };
@@ -7793,8 +7824,14 @@ var __webpack_modules__ = {
7793
7824
  for (const string_ of value.split(/ *, */)){
7794
7825
  const parts = string_.split(/ *; */);
7795
7826
  const url = parts[0].slice(1, -1);
7796
- const rel = parts[1].split(/ *= */)[1].slice(1, -1);
7797
- object[rel] = url;
7827
+ for (const part of parts.slice(1)){
7828
+ const [key, keyValue] = part.split(/ *= */, 2);
7829
+ if (key && 'rel' === key.toLowerCase() && keyValue) {
7830
+ const relationship = keyValue.replace(/^"|"$/g, '');
7831
+ if (relationship && exports1.isSafeKey(relationship)) object[relationship] = url;
7832
+ break;
7833
+ }
7834
+ }
7798
7835
  }
7799
7836
  return object;
7800
7837
  };
@@ -7810,19 +7847,19 @@ var __webpack_modules__ = {
7810
7847
  return header;
7811
7848
  };
7812
7849
  exports1.normalizeHostname = (hostname)=>{
7813
- const [, normalized] = hostname.match(/^\[([^\]]+)\]$/) || [];
7850
+ const [, normalized] = hostname.match(/^\[([^\]]+)]$/) || [];
7814
7851
  return normalized || hostname;
7815
7852
  };
7816
7853
  exports1.isObject = (object)=>null !== object && 'object' == typeof object;
7817
7854
  exports1.hasOwn = Object.hasOwn || function(object, property) {
7818
7855
  if (null == object) throw new TypeError('Cannot convert undefined or null to object');
7819
- return Object.prototype.hasOwnProperty.call(new Object(object), property);
7856
+ return Object.prototype.hasOwnProperty.call(Object(object), property);
7820
7857
  };
7821
7858
  exports1.mixin = (target, source)=>{
7822
7859
  for(const key in source)if (exports1.hasOwn(source, key)) target[key] = source[key];
7823
7860
  };
7824
- exports1.isGzipOrDeflateEncoding = (res)=>new RegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']);
7825
- exports1.isBrotliEncoding = (res)=>new RegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']);
7861
+ exports1.isGzipOrDeflateEncoding = (res)=>/^\s*(?:deflate|gzip)\s*$/i.test(res.headers['content-encoding']);
7862
+ exports1.isBrotliEncoding = (res)=>/^\s*br\s*$/i.test(res.headers['content-encoding']);
7826
7863
  },
7827
7864
  E (module, __unused_rspack_exports, __webpack_require__) {
7828
7865
  var Buffer = __webpack_require__("dY").Buffer;
@@ -10933,7 +10970,7 @@ var __webpack_exports__ = {};
10933
10970
  var client = __webpack_require__("Q");
10934
10971
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10935
10972
  var package_namespaceObject = {
10936
- rE: "15.7.7"
10973
+ rE: "15.7.8"
10937
10974
  };
10938
10975
  function isAudioEnabled(options) {
10939
10976
  return Boolean(options.audio.enabled);
@@ -17460,6 +17497,7 @@ var __webpack_exports__ = {};
17460
17497
  return obj;
17461
17498
  }
17462
17499
  const PIPE_SYMBOL = "°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸ ";
17500
+ const INITIAL_CONNECTION_RETRY_DELAY = 1e3;
17463
17501
  class Recorder extends util_Despot {
17464
17502
  writeStream(buffer, opts) {
17465
17503
  if (this.stream) if (this.stream.destroyed) {
@@ -17553,13 +17591,41 @@ var __webpack_exports__ = {};
17553
17591
  window.clearTimeout(this.connectionTimeout);
17554
17592
  this.connectionTimeout = void 0;
17555
17593
  }
17594
+ clearConnectionRetryTimeout() {
17595
+ if (!this.connectionRetryTimeout) return;
17596
+ this.options.logger.debug("Recorder: clearConnectionRetryTimeout()");
17597
+ window.clearTimeout(this.connectionRetryTimeout);
17598
+ this.connectionRetryTimeout = void 0;
17599
+ }
17600
+ retryInitialConnection(url2Connect) {
17601
+ const retryStartedAt = this.connectionRetryStartedAt;
17602
+ if (!retryStartedAt) return false;
17603
+ const retryElapsedMs = Date.now() - retryStartedAt;
17604
+ if (retryElapsedMs >= this.options.timeouts.connection) {
17605
+ this.connectionRetryStartedAt = void 0;
17606
+ return false;
17607
+ }
17608
+ const retryRemainingMs = this.options.timeouts.connection - retryElapsedMs;
17609
+ this.options.logger.debug(`Recorder: retrying initial web socket connection to ${url2Connect}`);
17610
+ this.connecting = false;
17611
+ if (this.stream) {
17612
+ this.stream.destroy();
17613
+ this.stream = void 0;
17614
+ }
17615
+ this.connectionRetryTimeout = window.setTimeout(()=>{
17616
+ this.connectionRetryTimeout = void 0;
17617
+ this.initSocket();
17618
+ }, Math.min(INITIAL_CONNECTION_RETRY_DELAY, retryRemainingMs));
17619
+ return true;
17620
+ }
17556
17621
  failConnection(params) {
17557
17622
  var _ref, _ref1;
17558
17623
  if (this.connectionFailed || this.connected || this.unloaded) return;
17559
- this.connectionFailed = true;
17560
- this.connecting = false;
17561
17624
  this.clearConnectionTimeout();
17562
17625
  const { url2Connect, cause } = params;
17626
+ if (this.retryInitialConnection(url2Connect)) return;
17627
+ this.connectionFailed = true;
17628
+ this.connecting = false;
17563
17629
  const online = navigator.onLine;
17564
17630
  const elapsedMs = this.connectingStartedAt ? Date.now() - this.connectingStartedAt : void 0;
17565
17631
  const closeEvent = this.lastCloseEvent;
@@ -17726,7 +17792,9 @@ var __webpack_exports__ = {};
17726
17792
  });
17727
17793
  }
17728
17794
  if (this.stream) {
17729
- const connectionTimeoutMs = this.options.timeouts.connection;
17795
+ if (!this.userMediaLoaded && !this.connectionRetryStartedAt) this.connectionRetryStartedAt = Date.now();
17796
+ const connectionRetryElapsedMs = this.connectionRetryStartedAt ? Date.now() - this.connectionRetryStartedAt : 0;
17797
+ const connectionTimeoutMs = this.connectionRetryStartedAt ? Math.max(0, this.options.timeouts.connection - connectionRetryElapsedMs) : this.options.timeouts.connection;
17730
17798
  this.connectionTimeout = window.setTimeout(()=>{
17731
17799
  this.failConnection({
17732
17800
  url2Connect,
@@ -17754,6 +17822,7 @@ var __webpack_exports__ = {};
17754
17822
  if (!this.connected && !isClosing && !this.unloaded) {
17755
17823
  this.connected = true;
17756
17824
  this.connecting = this.unloaded = false;
17825
+ this.connectionRetryStartedAt = void 0;
17757
17826
  this.emit("CONNECTED");
17758
17827
  null == cb || cb();
17759
17828
  }
@@ -18114,6 +18183,8 @@ var __webpack_exports__ = {};
18114
18183
  this.reset();
18115
18184
  this.clearUserMediaTimeout();
18116
18185
  this.clearConnectionTimeout();
18186
+ this.clearConnectionRetryTimeout();
18187
+ this.connectionRetryStartedAt = void 0;
18117
18188
  this.connecting = false;
18118
18189
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
18119
18190
  if (this.submitting) ;
@@ -18526,7 +18597,7 @@ var __webpack_exports__ = {};
18526
18597
  return this.userMediaLoaded;
18527
18598
  }
18528
18599
  constructor(visuals, replay, options){
18529
- super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "connectionTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "connectionFailed", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "connectingStartedAt", void 0), recorder_define_property(this, "lastCloseEvent", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
18600
+ super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "connectionTimeout", void 0), recorder_define_property(this, "connectionRetryTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "connectionFailed", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "connectingStartedAt", void 0), recorder_define_property(this, "connectionRetryStartedAt", void 0), recorder_define_property(this, "lastCloseEvent", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
18530
18601
  this.visuals = visuals;
18531
18602
  this.replay = replay;
18532
18603
  this.facingMode = options.video.facingMode;
package/dist/esm/index.js CHANGED
@@ -3619,7 +3619,7 @@ const constants = {
3619
3619
  }
3620
3620
  };
3621
3621
  var package_namespaceObject = {
3622
- rE: "15.7.7"
3622
+ rE: "15.7.8"
3623
3623
  };
3624
3624
  function isAudioEnabled(options) {
3625
3625
  return Boolean(options.audio.enabled);
@@ -6521,6 +6521,7 @@ function recorder_define_property(obj, key, value) {
6521
6521
  return obj;
6522
6522
  }
6523
6523
  const PIPE_SYMBOL = "°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸ ";
6524
+ const INITIAL_CONNECTION_RETRY_DELAY = 1e3;
6524
6525
  class Recorder extends util_Despot {
6525
6526
  writeStream(buffer, opts) {
6526
6527
  if (this.stream) if (this.stream.destroyed) {
@@ -6614,12 +6615,40 @@ class Recorder extends util_Despot {
6614
6615
  window.clearTimeout(this.connectionTimeout);
6615
6616
  this.connectionTimeout = void 0;
6616
6617
  }
6618
+ clearConnectionRetryTimeout() {
6619
+ if (!this.connectionRetryTimeout) return;
6620
+ this.options.logger.debug("Recorder: clearConnectionRetryTimeout()");
6621
+ window.clearTimeout(this.connectionRetryTimeout);
6622
+ this.connectionRetryTimeout = void 0;
6623
+ }
6624
+ retryInitialConnection(url2Connect) {
6625
+ const retryStartedAt = this.connectionRetryStartedAt;
6626
+ if (!retryStartedAt) return false;
6627
+ const retryElapsedMs = Date.now() - retryStartedAt;
6628
+ if (retryElapsedMs >= this.options.timeouts.connection) {
6629
+ this.connectionRetryStartedAt = void 0;
6630
+ return false;
6631
+ }
6632
+ const retryRemainingMs = this.options.timeouts.connection - retryElapsedMs;
6633
+ this.options.logger.debug(`Recorder: retrying initial web socket connection to ${url2Connect}`);
6634
+ this.connecting = false;
6635
+ if (this.stream) {
6636
+ this.stream.destroy();
6637
+ this.stream = void 0;
6638
+ }
6639
+ this.connectionRetryTimeout = window.setTimeout(()=>{
6640
+ this.connectionRetryTimeout = void 0;
6641
+ this.initSocket();
6642
+ }, Math.min(INITIAL_CONNECTION_RETRY_DELAY, retryRemainingMs));
6643
+ return true;
6644
+ }
6617
6645
  failConnection(params) {
6618
6646
  if (this.connectionFailed || this.connected || this.unloaded) return;
6619
- this.connectionFailed = true;
6620
- this.connecting = false;
6621
6647
  this.clearConnectionTimeout();
6622
6648
  const { url2Connect, cause } = params;
6649
+ if (this.retryInitialConnection(url2Connect)) return;
6650
+ this.connectionFailed = true;
6651
+ this.connecting = false;
6623
6652
  const online = navigator.onLine;
6624
6653
  const elapsedMs = this.connectingStartedAt ? Date.now() - this.connectingStartedAt : void 0;
6625
6654
  const closeEvent = this.lastCloseEvent;
@@ -6785,7 +6814,9 @@ class Recorder extends util_Despot {
6785
6814
  });
6786
6815
  }
6787
6816
  if (this.stream) {
6788
- const connectionTimeoutMs = this.options.timeouts.connection;
6817
+ if (!this.userMediaLoaded && !this.connectionRetryStartedAt) this.connectionRetryStartedAt = Date.now();
6818
+ const connectionRetryElapsedMs = this.connectionRetryStartedAt ? Date.now() - this.connectionRetryStartedAt : 0;
6819
+ const connectionTimeoutMs = this.connectionRetryStartedAt ? Math.max(0, this.options.timeouts.connection - connectionRetryElapsedMs) : this.options.timeouts.connection;
6789
6820
  this.connectionTimeout = window.setTimeout(()=>{
6790
6821
  this.failConnection({
6791
6822
  url2Connect,
@@ -6812,6 +6843,7 @@ class Recorder extends util_Despot {
6812
6843
  if (!this.connected && !isClosing && !this.unloaded) {
6813
6844
  this.connected = true;
6814
6845
  this.connecting = this.unloaded = false;
6846
+ this.connectionRetryStartedAt = void 0;
6815
6847
  this.emit("CONNECTED");
6816
6848
  cb?.();
6817
6849
  }
@@ -7166,6 +7198,8 @@ class Recorder extends util_Despot {
7166
7198
  this.reset();
7167
7199
  this.clearUserMediaTimeout();
7168
7200
  this.clearConnectionTimeout();
7201
+ this.clearConnectionRetryTimeout();
7202
+ this.connectionRetryStartedAt = void 0;
7169
7203
  this.connecting = false;
7170
7204
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
7171
7205
  if (this.submitting) ;
@@ -7569,7 +7603,7 @@ class Recorder extends util_Despot {
7569
7603
  return this.userMediaLoaded;
7570
7604
  }
7571
7605
  constructor(visuals, replay, options){
7572
- super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "connectionTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "connectionFailed", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "connectingStartedAt", void 0), recorder_define_property(this, "lastCloseEvent", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
7606
+ super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "connectionTimeout", void 0), recorder_define_property(this, "connectionRetryTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "connectionFailed", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "connectingStartedAt", void 0), recorder_define_property(this, "connectionRetryStartedAt", void 0), recorder_define_property(this, "lastCloseEvent", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
7573
7607
  this.visuals = visuals;
7574
7608
  this.replay = replay;
7575
7609
  this.facingMode = options.video.facingMode;
@@ -26,6 +26,7 @@ declare class Recorder extends Despot {
26
26
  private userMediaTimeout?;
27
27
  private retryTimeout?;
28
28
  private connectionTimeout?;
29
+ private connectionRetryTimeout?;
29
30
  private frameProgress?;
30
31
  private sampleProgress?;
31
32
  private canvas?;
@@ -44,6 +45,7 @@ declare class Recorder extends Despot {
44
45
  private key?;
45
46
  private waitingTime?;
46
47
  private connectingStartedAt?;
48
+ private connectionRetryStartedAt?;
47
49
  private lastCloseEvent?;
48
50
  private pingInterval?;
49
51
  private frame?;
@@ -58,6 +60,8 @@ declare class Recorder extends Despot {
58
60
  private onUserMediaReady;
59
61
  private clearRetryTimeout;
60
62
  private clearConnectionTimeout;
63
+ private clearConnectionRetryTimeout;
64
+ private retryInitialConnection;
61
65
  private failConnection;
62
66
  private calculateFrameProgress;
63
67
  private calculateSampleProgress;
package/dist/umd/index.js CHANGED
@@ -7051,7 +7051,7 @@
7051
7051
  const safeStringify = __webpack_require__("X");
7052
7052
  const qs = __webpack_require__("b");
7053
7053
  const RequestBase = __webpack_require__("d");
7054
- const { isObject, mixin, hasOwn } = __webpack_require__("Dp");
7054
+ const { isObject, mixin, hasOwn, isSafeKey } = __webpack_require__("Dp");
7055
7055
  const ResponseBase = __webpack_require__("e");
7056
7056
  const Agent = __webpack_require__("pf");
7057
7057
  function noop() {}
@@ -7105,12 +7105,18 @@
7105
7105
  form: 'application/x-www-form-urlencoded',
7106
7106
  'form-data': 'application/x-www-form-urlencoded'
7107
7107
  };
7108
+ function lookupType(type) {
7109
+ return hasOwn(request.types, type) && request.types[type] || type;
7110
+ }
7108
7111
  request.serialize = {
7109
- 'application/x-www-form-urlencoded': (obj)=>qs.stringify(obj, {
7112
+ 'application/x-www-form-urlencoded' (object) {
7113
+ return qs.stringify(object, {
7110
7114
  indices: false,
7111
7115
  strictNullHandling: true
7112
- }),
7113
- 'application/json': safeStringify
7116
+ });
7117
+ },
7118
+ 'application/json': safeStringify,
7119
+ 'application/csp-report': safeStringify
7114
7120
  };
7115
7121
  request.parse = {
7116
7122
  'application/x-www-form-urlencoded': parseString,
@@ -7128,8 +7134,10 @@
7128
7134
  index = line.indexOf(':');
7129
7135
  if (-1 !== index) {
7130
7136
  field = line.slice(0, index).toLowerCase();
7131
- value = trim(line.slice(index + 1));
7132
- fields[field] = value;
7137
+ if (isSafeKey(field)) {
7138
+ value = trim(line.slice(index + 1));
7139
+ fields[field] = value;
7140
+ }
7133
7141
  }
7134
7142
  }
7135
7143
  return fields;
@@ -7150,11 +7158,12 @@
7150
7158
  this.header['content-type'] = this.xhr.getResponseHeader('content-type');
7151
7159
  this._setHeaderProperties(this.header);
7152
7160
  if (null === this.text && request_._responseType) this.body = this.xhr.response;
7153
- else this.body = 'HEAD' === this.req.method ? null : this._parseBody(this.text ? this.text : this.xhr.response);
7161
+ else if ('HEAD' === this.req.method) this.body = null;
7162
+ else this.body = this._parseBody(this.text || this.xhr.response);
7154
7163
  }
7155
7164
  mixin(Response.prototype, ResponseBase.prototype);
7156
7165
  Response.prototype._parseBody = function(string_) {
7157
- let parse = request.parse[this.type];
7166
+ let parse = hasOwn(request.parse, this.type) ? request.parse[this.type] : void 0;
7158
7167
  if (this.req._parser) return this.req._parser(this, string_);
7159
7168
  if (!parse && isJSON(this.type)) parse = request.parse['application/json'];
7160
7169
  return parse && string_ && (string_.length > 0 || string_ instanceof Object) ? parse(string_) : null;
@@ -7189,7 +7198,7 @@
7189
7198
  error.original = err;
7190
7199
  if (self1.xhr) {
7191
7200
  error.rawResponse = void 0 === self1.xhr.responseType ? self1.xhr.responseText : self1.xhr.response;
7192
- error.status = self1.xhr.status ? self1.xhr.status : null;
7201
+ error.status = self1.xhr.status || null;
7193
7202
  error.statusCode = error.status;
7194
7203
  } else {
7195
7204
  error.rawResponse = null;
@@ -7215,11 +7224,11 @@
7215
7224
  Emitter(Request.prototype);
7216
7225
  mixin(Request.prototype, RequestBase.prototype);
7217
7226
  Request.prototype.type = function(type) {
7218
- this.set('Content-Type', request.types[type] || type);
7227
+ this.set('Content-Type', lookupType(type));
7219
7228
  return this;
7220
7229
  };
7221
7230
  Request.prototype.accept = function(type) {
7222
- this.set('Accept', request.types[type] || type);
7231
+ this.set('Accept', lookupType(type));
7223
7232
  return this;
7224
7233
  };
7225
7234
  Request.prototype.auth = function(user, pass, options) {
@@ -7231,7 +7240,8 @@
7231
7240
  if (!options) options = {
7232
7241
  type: 'function' == typeof btoa ? 'basic' : 'auto'
7233
7242
  };
7234
- const encoder = options.encoder ? options.encoder : (string)=>{
7243
+ let { encoder } = options;
7244
+ if (!encoder) encoder = (string)=>{
7235
7245
  if ('function' == typeof btoa) return btoa(string);
7236
7246
  throw new Error('Cannot use basic auth, btoa is not a function');
7237
7247
  };
@@ -7342,16 +7352,24 @@
7342
7352
  if (this._withCredentials) xhr.withCredentials = true;
7343
7353
  if (!this._formData && 'GET' !== this.method && 'HEAD' !== this.method && 'string' != typeof data && !this._isHost(data)) {
7344
7354
  const contentType = this._header['content-type'];
7345
- let serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
7355
+ const serializeType = contentType ? contentType.split(';')[0] : '';
7356
+ let serialize = this._serializer || (hasOwn(request.serialize, serializeType) ? request.serialize[serializeType] : void 0);
7346
7357
  if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];
7347
7358
  if (serialize) data = serialize(data);
7348
7359
  }
7349
- for(const field in this.header)if (null !== this.header[field]) {
7350
- if (hasOwn(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
7360
+ try {
7361
+ for(const field in this.header)if (null !== this.header[field]) {
7362
+ if (hasOwn(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
7363
+ }
7364
+ if (this._responseType) xhr.responseType = this._responseType;
7365
+ this.emit('request', this);
7366
+ xhr.send(void 0 === data ? null : data);
7367
+ } catch (err) {
7368
+ try {
7369
+ xhr.abort();
7370
+ } catch (err) {}
7371
+ return this.callback(err);
7351
7372
  }
7352
- if (this._responseType) xhr.responseType = this._responseType;
7353
- this.emit('request', this);
7354
- xhr.send(void 0 === data ? null : data);
7355
7373
  };
7356
7374
  const proxyAgent = new Proxy(Agent, {
7357
7375
  apply (target, thisArg, argumentsList) {
@@ -7361,6 +7379,7 @@
7361
7379
  request.agent = proxyAgent;
7362
7380
  for (const method of [
7363
7381
  'GET',
7382
+ 'HEAD',
7364
7383
  'POST',
7365
7384
  'OPTIONS',
7366
7385
  'PATCH',
@@ -7448,7 +7467,7 @@
7448
7467
  },
7449
7468
  d (module1, __unused_rspack_exports, __webpack_require__) {
7450
7469
  "use strict";
7451
- const { isObject, hasOwn } = __webpack_require__("Dp");
7470
+ const { isObject, hasOwn, isSafeKey } = __webpack_require__("Dp");
7452
7471
  module1.exports = RequestBase;
7453
7472
  function RequestBase() {}
7454
7473
  RequestBase.prototype.clearTimeout = function() {
@@ -7558,7 +7577,7 @@
7558
7577
  if (this._endCalled) console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
7559
7578
  this._fullfilledPromise = new Promise((resolve, reject)=>{
7560
7579
  self1.on('abort', ()=>{
7561
- if (this._maxRetries && this._maxRetries > this._retries) return;
7580
+ if (this.timedout && this._maxRetries && this._maxRetries > this._retries) return;
7562
7581
  if (this.timedout && this.timedoutError) return void reject(this.timedoutError);
7563
7582
  const error = new Error('Aborted');
7564
7583
  error.code = 'ABORTED';
@@ -7685,7 +7704,13 @@
7685
7704
  } else if (data && this._data && this._isHost(this._data)) throw new Error("Can't merge these send calls");
7686
7705
  if (isObject_ && isObject(this._data)) for(const key in data){
7687
7706
  if ('bigint' == typeof data[key] && !data[key].toJSON) throw new Error('Cannot serialize BigInt value to json');
7688
- if (hasOwn(data, key)) this._data[key] = data[key];
7707
+ if (hasOwn(data, key)) if (isSafeKey(key)) this._data[key] = data[key];
7708
+ else Object.defineProperty(this._data, key, {
7709
+ value: data[key],
7710
+ enumerable: true,
7711
+ writable: true,
7712
+ configurable: true
7713
+ });
7689
7714
  }
7690
7715
  else if ('bigint' == typeof data) throw new Error("Cannot send value of type BigInt");
7691
7716
  else if ('string' == typeof data) {
@@ -7753,7 +7778,7 @@
7753
7778
  const ct = header['content-type'] || '';
7754
7779
  this.type = utils.type(ct);
7755
7780
  const parameters = utils.params(ct);
7756
- for(const key in parameters)if (Object.prototype.hasOwnProperty.call(parameters, key)) this[key] = parameters[key];
7781
+ for(const key in parameters)if (Object.prototype.hasOwnProperty.call(parameters, key) && !(key in this)) this[key] = parameters[key];
7757
7782
  this.links = {};
7758
7783
  try {
7759
7784
  if (header.link) this.links = utils.parseLinks(header.link);
@@ -7784,13 +7809,19 @@
7784
7809
  Dp (__unused_rspack_module, exports1) {
7785
7810
  "use strict";
7786
7811
  exports1.type = (string_)=>string_.split(/ *; */).shift();
7812
+ const UNSAFE_KEYS = new Set([
7813
+ '__proto__',
7814
+ 'constructor',
7815
+ 'prototype'
7816
+ ]);
7817
+ exports1.isSafeKey = (key)=>!UNSAFE_KEYS.has(key);
7787
7818
  exports1.params = (value)=>{
7788
7819
  const object = {};
7789
7820
  for (const string_ of value.split(/ *; */)){
7790
7821
  const parts = string_.split(/ *= */);
7791
7822
  const key = parts.shift();
7792
7823
  const value = parts.shift();
7793
- if (key && value) object[key] = value;
7824
+ if (key && value && exports1.isSafeKey(key)) object[key] = value;
7794
7825
  }
7795
7826
  return object;
7796
7827
  };
@@ -7799,8 +7830,14 @@
7799
7830
  for (const string_ of value.split(/ *, */)){
7800
7831
  const parts = string_.split(/ *; */);
7801
7832
  const url = parts[0].slice(1, -1);
7802
- const rel = parts[1].split(/ *= */)[1].slice(1, -1);
7803
- object[rel] = url;
7833
+ for (const part of parts.slice(1)){
7834
+ const [key, keyValue] = part.split(/ *= */, 2);
7835
+ if (key && 'rel' === key.toLowerCase() && keyValue) {
7836
+ const relationship = keyValue.replace(/^"|"$/g, '');
7837
+ if (relationship && exports1.isSafeKey(relationship)) object[relationship] = url;
7838
+ break;
7839
+ }
7840
+ }
7804
7841
  }
7805
7842
  return object;
7806
7843
  };
@@ -7816,19 +7853,19 @@
7816
7853
  return header;
7817
7854
  };
7818
7855
  exports1.normalizeHostname = (hostname)=>{
7819
- const [, normalized] = hostname.match(/^\[([^\]]+)\]$/) || [];
7856
+ const [, normalized] = hostname.match(/^\[([^\]]+)]$/) || [];
7820
7857
  return normalized || hostname;
7821
7858
  };
7822
7859
  exports1.isObject = (object)=>null !== object && 'object' == typeof object;
7823
7860
  exports1.hasOwn = Object.hasOwn || function(object, property) {
7824
7861
  if (null == object) throw new TypeError('Cannot convert undefined or null to object');
7825
- return Object.prototype.hasOwnProperty.call(new Object(object), property);
7862
+ return Object.prototype.hasOwnProperty.call(Object(object), property);
7826
7863
  };
7827
7864
  exports1.mixin = (target, source)=>{
7828
7865
  for(const key in source)if (exports1.hasOwn(source, key)) target[key] = source[key];
7829
7866
  };
7830
- exports1.isGzipOrDeflateEncoding = (res)=>new RegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']);
7831
- exports1.isBrotliEncoding = (res)=>new RegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']);
7867
+ exports1.isGzipOrDeflateEncoding = (res)=>/^\s*(?:deflate|gzip)\s*$/i.test(res.headers['content-encoding']);
7868
+ exports1.isBrotliEncoding = (res)=>/^\s*br\s*$/i.test(res.headers['content-encoding']);
7832
7869
  },
7833
7870
  E (module1, __unused_rspack_exports, __webpack_require__) {
7834
7871
  var Buffer = __webpack_require__("dY").Buffer;
@@ -10939,7 +10976,7 @@
10939
10976
  var client = __webpack_require__("Q");
10940
10977
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10941
10978
  var package_namespaceObject = {
10942
- rE: "15.7.7"
10979
+ rE: "15.7.8"
10943
10980
  };
10944
10981
  function isAudioEnabled(options) {
10945
10982
  return Boolean(options.audio.enabled);
@@ -17190,6 +17227,7 @@
17190
17227
  const visuals_userMedia = UserMedia;
17191
17228
  var Buffer = __webpack_require__("dY").Buffer;
17192
17229
  const PIPE_SYMBOL = "°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸ ";
17230
+ const INITIAL_CONNECTION_RETRY_DELAY = 1e3;
17193
17231
  class Recorder extends util_Despot {
17194
17232
  visuals;
17195
17233
  replay;
@@ -17205,6 +17243,7 @@
17205
17243
  userMediaTimeout;
17206
17244
  retryTimeout;
17207
17245
  connectionTimeout;
17246
+ connectionRetryTimeout;
17208
17247
  frameProgress;
17209
17248
  sampleProgress;
17210
17249
  canvas;
@@ -17223,6 +17262,7 @@
17223
17262
  key;
17224
17263
  waitingTime;
17225
17264
  connectingStartedAt;
17265
+ connectionRetryStartedAt;
17226
17266
  lastCloseEvent;
17227
17267
  pingInterval;
17228
17268
  frame;
@@ -17326,12 +17366,40 @@
17326
17366
  window.clearTimeout(this.connectionTimeout);
17327
17367
  this.connectionTimeout = void 0;
17328
17368
  }
17369
+ clearConnectionRetryTimeout() {
17370
+ if (!this.connectionRetryTimeout) return;
17371
+ this.options.logger.debug("Recorder: clearConnectionRetryTimeout()");
17372
+ window.clearTimeout(this.connectionRetryTimeout);
17373
+ this.connectionRetryTimeout = void 0;
17374
+ }
17375
+ retryInitialConnection(url2Connect) {
17376
+ const retryStartedAt = this.connectionRetryStartedAt;
17377
+ if (!retryStartedAt) return false;
17378
+ const retryElapsedMs = Date.now() - retryStartedAt;
17379
+ if (retryElapsedMs >= this.options.timeouts.connection) {
17380
+ this.connectionRetryStartedAt = void 0;
17381
+ return false;
17382
+ }
17383
+ const retryRemainingMs = this.options.timeouts.connection - retryElapsedMs;
17384
+ this.options.logger.debug(`Recorder: retrying initial web socket connection to ${url2Connect}`);
17385
+ this.connecting = false;
17386
+ if (this.stream) {
17387
+ this.stream.destroy();
17388
+ this.stream = void 0;
17389
+ }
17390
+ this.connectionRetryTimeout = window.setTimeout(()=>{
17391
+ this.connectionRetryTimeout = void 0;
17392
+ this.initSocket();
17393
+ }, Math.min(INITIAL_CONNECTION_RETRY_DELAY, retryRemainingMs));
17394
+ return true;
17395
+ }
17329
17396
  failConnection(params) {
17330
17397
  if (this.connectionFailed || this.connected || this.unloaded) return;
17331
- this.connectionFailed = true;
17332
- this.connecting = false;
17333
17398
  this.clearConnectionTimeout();
17334
17399
  const { url2Connect, cause } = params;
17400
+ if (this.retryInitialConnection(url2Connect)) return;
17401
+ this.connectionFailed = true;
17402
+ this.connecting = false;
17335
17403
  const online = navigator.onLine;
17336
17404
  const elapsedMs = this.connectingStartedAt ? Date.now() - this.connectingStartedAt : void 0;
17337
17405
  const closeEvent = this.lastCloseEvent;
@@ -17497,7 +17565,9 @@
17497
17565
  });
17498
17566
  }
17499
17567
  if (this.stream) {
17500
- const connectionTimeoutMs = this.options.timeouts.connection;
17568
+ if (!this.userMediaLoaded && !this.connectionRetryStartedAt) this.connectionRetryStartedAt = Date.now();
17569
+ const connectionRetryElapsedMs = this.connectionRetryStartedAt ? Date.now() - this.connectionRetryStartedAt : 0;
17570
+ const connectionTimeoutMs = this.connectionRetryStartedAt ? Math.max(0, this.options.timeouts.connection - connectionRetryElapsedMs) : this.options.timeouts.connection;
17501
17571
  this.connectionTimeout = window.setTimeout(()=>{
17502
17572
  this.failConnection({
17503
17573
  url2Connect,
@@ -17524,6 +17594,7 @@
17524
17594
  if (!this.connected && !isClosing && !this.unloaded) {
17525
17595
  this.connected = true;
17526
17596
  this.connecting = this.unloaded = false;
17597
+ this.connectionRetryStartedAt = void 0;
17527
17598
  this.emit("CONNECTED");
17528
17599
  cb?.();
17529
17600
  }
@@ -17878,6 +17949,8 @@
17878
17949
  this.reset();
17879
17950
  this.clearUserMediaTimeout();
17880
17951
  this.clearConnectionTimeout();
17952
+ this.clearConnectionRetryTimeout();
17953
+ this.connectionRetryStartedAt = void 0;
17881
17954
  this.connecting = false;
17882
17955
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
17883
17956
  if (this.submitting) ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "15.7.7",
3
+ "version": "15.7.8",
4
4
  "description": "A wicked npm package to record videos directly in the browser, for Deaf and Sign Language!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -70,7 +70,7 @@
70
70
  "is-power-of-two": "1.0.0",
71
71
  "nanoevents": "10.0.0",
72
72
  "serialize-error": "13.0.1",
73
- "superagent": "10.3.0",
73
+ "superagent": "10.4.1",
74
74
  "ua-parser-js": "2.0.10",
75
75
  "websocket-stream": "5.5.2"
76
76
  },
@@ -81,7 +81,7 @@
81
81
  "@rsbuild/plugin-node-polyfill": "1.4.6",
82
82
  "@rsbuild/plugin-stylus": "2.0.1",
83
83
  "@rsdoctor/rspack-plugin": "1.6.4",
84
- "@rslib/core": "1.0.1",
84
+ "@rslib/core": "1.0.2",
85
85
  "@storybook/addon-a11y": "10.6.0",
86
86
  "@storybook/addon-docs": "10.6.0",
87
87
  "@storybook/addon-links": "10.6.0",
@@ -89,37 +89,37 @@
89
89
  "@tsconfig/node26": "26.0.1",
90
90
  "@tsconfig/strictest": "2.0.8",
91
91
  "@types/defined": "1.0.2",
92
- "@types/node": "26.6.2",
92
+ "@types/node": "26.6.3",
93
93
  "@types/superagent": "8.1.11",
94
94
  "@types/ua-parser-js": "0.7.39",
95
95
  "@vitest/eslint-plugin": "1.6.27",
96
96
  "audit-ci": "7.1.0",
97
- "chromatic": "18.9.4",
97
+ "chromatic": "18.9.5",
98
98
  "cross-env": "10.1.0",
99
99
  "eslint": "10.11.0",
100
100
  "eslint-import-resolver-typescript": "4.4.5",
101
101
  "eslint-plugin-de-morgan": "2.2.0",
102
102
  "eslint-plugin-depend": "1.5.0",
103
103
  "eslint-plugin-import-x": "4.17.1",
104
- "eslint-plugin-package-json": "1.9.0",
104
+ "eslint-plugin-package-json": "1.10.0",
105
105
  "eslint-plugin-regexp": "3.3.1",
106
106
  "eslint-plugin-simple-import-sort": "14.0.0",
107
107
  "globals": "17.12.0",
108
- "jsdom": "30.1.0",
108
+ "jsdom": "30.1.1",
109
109
  "msw": "2.15.0",
110
110
  "msw-storybook-addon": "3.0.3",
111
- "prettier": "3.9.8",
111
+ "prettier": "3.9.9",
112
112
  "prettier-plugin-curly": "0.4.1",
113
113
  "prettier-plugin-jsdoc": "1.8.1",
114
114
  "prettier-plugin-packagejson": "3.0.2",
115
- "prettier-plugin-sh": "0.19.0",
115
+ "prettier-plugin-sh": "0.20.2",
116
116
  "release-it": "21.1.0",
117
117
  "storybook": "10.6.0",
118
118
  "storybook-html-rsbuild": "3.6.0",
119
119
  "type-fest": "5.10.0",
120
120
  "typescript": "6.0.3",
121
- "typescript-eslint": "8.70.0",
122
- "vitest": "5.0.1"
121
+ "typescript-eslint": "8.70.1",
122
+ "vitest": "5.0.2"
123
123
  },
124
124
  "engines": {
125
125
  "node": "^26.5.0",