videomail-client 16.0.1 → 16.0.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.
@@ -11115,7 +11115,7 @@ var __webpack_exports__ = {};
11115
11115
  var client = __webpack_require__("Q");
11116
11116
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
11117
11117
  var package_namespaceObject = {
11118
- rE: "16.0.1"
11118
+ rE: "16.0.2"
11119
11119
  };
11120
11120
  function isAudioEnabled(options) {
11121
11121
  return Boolean(options.audio.enabled);
@@ -20096,6 +20096,7 @@ var __webpack_exports__ = {};
20096
20096
  this.options.logger.debug(debugLine);
20097
20097
  const canReconnect = this.canReconnectAfterStreamClose();
20098
20098
  this.connected = false;
20099
+ this.stopPings();
20099
20100
  if (this.shouldIgnoreStreamClose()) return;
20100
20101
  if (this.mediaTransmissionStarted) this.failInterruptedRecording();
20101
20102
  else if (canReconnect) {
@@ -20112,7 +20113,38 @@ var __webpack_exports__ = {};
20112
20113
  }, 0);
20113
20114
  }
20114
20115
  shouldIgnoreStreamClose() {
20115
- return this.recordingTransportFailed || Boolean(this.unloaded);
20116
+ return this.recordingTransportFailed || Boolean(this.unloaded) || this.validate();
20117
+ }
20118
+ handleStreamError(url2Connect, err) {
20119
+ var _this_lastSocketError;
20120
+ if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
20121
+ else this.lastSocketError = serializeError(err);
20122
+ const debugLine = string_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
20123
+ error: serializeError(err)
20124
+ });
20125
+ this.options.logger.debug(debugLine);
20126
+ if (this.validate()) {
20127
+ this.connected = false;
20128
+ this.stopPings();
20129
+ this.discardSocket();
20130
+ return;
20131
+ }
20132
+ if (!this.connected) return void this.handleConnectionFailure({
20133
+ url2Connect,
20134
+ cause: "error"
20135
+ });
20136
+ const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
20137
+ cause: null != (_this_lastSocketError = this.lastSocketError) ? _this_lastSocketError : err
20138
+ });
20139
+ if (this.mediaTransmissionStarted) return void this.failInterruptedRecording();
20140
+ this.emit("ERROR", {
20141
+ err: error_createError({
20142
+ message: "WebSocket stream error",
20143
+ explanation: `The WebSocket stream emitted an error event. Details: ${string_pretty(err)}`,
20144
+ options: this.options,
20145
+ exc: streamError
20146
+ })
20147
+ });
20116
20148
  }
20117
20149
  sendPings() {
20118
20150
  this.stopPings();
@@ -20123,6 +20155,7 @@ var __webpack_exports__ = {};
20123
20155
  }
20124
20156
  stopPings() {
20125
20157
  if (void 0 === this.pingInterval) return;
20158
+ this.options.logger.debug("Recorder: stopping pings...");
20126
20159
  window.clearInterval(this.pingInterval);
20127
20160
  this.pingInterval = void 0;
20128
20161
  }
@@ -20275,7 +20308,7 @@ var __webpack_exports__ = {};
20275
20308
  });
20276
20309
  }
20277
20310
  shouldIgnoreConnectionFailure() {
20278
- return this.connectionFailed || this.connected || Boolean(this.unloaded);
20311
+ return this.connectionFailed || this.connected || Boolean(this.unloaded) || this.validate();
20279
20312
  }
20280
20313
  calculateFrameProgress() {
20281
20314
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
@@ -20483,29 +20516,7 @@ var __webpack_exports__ = {};
20483
20516
  }
20484
20517
  });
20485
20518
  stream.on("error", (err)=>{
20486
- var _this_lastSocketError;
20487
- if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
20488
- else this.lastSocketError = serializeError(err);
20489
- const debugLine = string_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
20490
- error: serializeError(err)
20491
- });
20492
- this.options.logger.debug(debugLine);
20493
- if (!this.connected) return void this.handleConnectionFailure({
20494
- url2Connect,
20495
- cause: "error"
20496
- });
20497
- const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
20498
- cause: null != (_this_lastSocketError = this.lastSocketError) ? _this_lastSocketError : err
20499
- });
20500
- if (this.mediaTransmissionStarted) return void this.failInterruptedRecording();
20501
- this.emit("ERROR", {
20502
- err: error_createError({
20503
- message: "WebSocket stream error",
20504
- explanation: `The WebSocket stream emitted an error event. Details: ${string_pretty(err)}`,
20505
- options: this.options,
20506
- exc: streamError
20507
- })
20508
- });
20519
+ this.handleStreamError(url2Connect, err);
20509
20520
  });
20510
20521
  stream.on("drain", ()=>{
20511
20522
  this.handleStreamDrain(stream);
@@ -20853,6 +20864,7 @@ var __webpack_exports__ = {};
20853
20864
  }
20854
20865
  back(cb) {
20855
20866
  this.emit("GOING_BACK");
20867
+ this.key = void 0;
20856
20868
  this.recordingDimensions = void 0;
20857
20869
  this.unloaded = false;
20858
20870
  this.show();
@@ -20919,7 +20931,7 @@ var __webpack_exports__ = {};
20919
20931
  this.stopTimeout = void 0;
20920
20932
  }
20921
20933
  validate() {
20922
- return this.connected && void 0 === this.canvas;
20934
+ return Boolean(this.key) && void 0 === this.canvas;
20923
20935
  }
20924
20936
  isReady() {
20925
20937
  var _this_userMedia;
package/dist/esm/index.js CHANGED
@@ -3620,7 +3620,7 @@ const constants = {
3620
3620
  }
3621
3621
  };
3622
3622
  var package_namespaceObject = {
3623
- rE: "16.0.1"
3623
+ rE: "16.0.2"
3624
3624
  };
3625
3625
  function isAudioEnabled(options) {
3626
3626
  return Boolean(options.audio.enabled);
@@ -6875,6 +6875,7 @@ class Recorder extends util_Despot {
6875
6875
  this.options.logger.debug(debugLine);
6876
6876
  const canReconnect = this.canReconnectAfterStreamClose();
6877
6877
  this.connected = false;
6878
+ this.stopPings();
6878
6879
  if (this.shouldIgnoreStreamClose()) return;
6879
6880
  if (this.mediaTransmissionStarted) this.failInterruptedRecording();
6880
6881
  else if (canReconnect) {
@@ -6891,7 +6892,37 @@ class Recorder extends util_Despot {
6891
6892
  }, 0);
6892
6893
  }
6893
6894
  shouldIgnoreStreamClose() {
6894
- return this.recordingTransportFailed || Boolean(this.unloaded);
6895
+ return this.recordingTransportFailed || Boolean(this.unloaded) || this.validate();
6896
+ }
6897
+ handleStreamError(url2Connect, err) {
6898
+ if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
6899
+ else this.lastSocketError = serializeError(err);
6900
+ const debugLine = string_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
6901
+ error: serializeError(err)
6902
+ });
6903
+ this.options.logger.debug(debugLine);
6904
+ if (this.validate()) {
6905
+ this.connected = false;
6906
+ this.stopPings();
6907
+ this.discardSocket();
6908
+ return;
6909
+ }
6910
+ if (!this.connected) return void this.handleConnectionFailure({
6911
+ url2Connect,
6912
+ cause: "error"
6913
+ });
6914
+ const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
6915
+ cause: this.lastSocketError ?? err
6916
+ });
6917
+ if (this.mediaTransmissionStarted) return void this.failInterruptedRecording();
6918
+ this.emit("ERROR", {
6919
+ err: error_createError({
6920
+ message: "WebSocket stream error",
6921
+ explanation: `The WebSocket stream emitted an error event. Details: ${string_pretty(err)}`,
6922
+ options: this.options,
6923
+ exc: streamError
6924
+ })
6925
+ });
6895
6926
  }
6896
6927
  sendPings() {
6897
6928
  this.stopPings();
@@ -6902,6 +6933,7 @@ class Recorder extends util_Despot {
6902
6933
  }
6903
6934
  stopPings() {
6904
6935
  if (void 0 === this.pingInterval) return;
6936
+ this.options.logger.debug("Recorder: stopping pings...");
6905
6937
  window.clearInterval(this.pingInterval);
6906
6938
  this.pingInterval = void 0;
6907
6939
  }
@@ -7053,7 +7085,7 @@ class Recorder extends util_Despot {
7053
7085
  });
7054
7086
  }
7055
7087
  shouldIgnoreConnectionFailure() {
7056
- return this.connectionFailed || this.connected || Boolean(this.unloaded);
7088
+ return this.connectionFailed || this.connected || Boolean(this.unloaded) || this.validate();
7057
7089
  }
7058
7090
  calculateFrameProgress() {
7059
7091
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
@@ -7259,28 +7291,7 @@ class Recorder extends util_Despot {
7259
7291
  }
7260
7292
  });
7261
7293
  stream.on("error", (err)=>{
7262
- if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
7263
- else this.lastSocketError = serializeError(err);
7264
- const debugLine = string_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
7265
- error: serializeError(err)
7266
- });
7267
- this.options.logger.debug(debugLine);
7268
- if (!this.connected) return void this.handleConnectionFailure({
7269
- url2Connect,
7270
- cause: "error"
7271
- });
7272
- const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
7273
- cause: this.lastSocketError ?? err
7274
- });
7275
- if (this.mediaTransmissionStarted) return void this.failInterruptedRecording();
7276
- this.emit("ERROR", {
7277
- err: error_createError({
7278
- message: "WebSocket stream error",
7279
- explanation: `The WebSocket stream emitted an error event. Details: ${string_pretty(err)}`,
7280
- options: this.options,
7281
- exc: streamError
7282
- })
7283
- });
7294
+ this.handleStreamError(url2Connect, err);
7284
7295
  });
7285
7296
  stream.on("drain", ()=>{
7286
7297
  this.handleStreamDrain(stream);
@@ -7621,6 +7632,7 @@ class Recorder extends util_Despot {
7621
7632
  }
7622
7633
  back(cb) {
7623
7634
  this.emit("GOING_BACK");
7635
+ this.key = void 0;
7624
7636
  this.recordingDimensions = void 0;
7625
7637
  this.unloaded = false;
7626
7638
  this.show();
@@ -7685,7 +7697,7 @@ class Recorder extends util_Despot {
7685
7697
  this.stopTimeout = void 0;
7686
7698
  }
7687
7699
  validate() {
7688
- return this.connected && void 0 === this.canvas;
7700
+ return Boolean(this.key) && void 0 === this.canvas;
7689
7701
  }
7690
7702
  isReady() {
7691
7703
  return this.userMedia?.isReady();
@@ -83,6 +83,7 @@ declare class Recorder extends Despot {
83
83
  private shouldReportStreamClose;
84
84
  private handleStreamClose;
85
85
  private shouldIgnoreStreamClose;
86
+ private handleStreamError;
86
87
  private sendPings;
87
88
  private stopPings;
88
89
  private onAudioSample;
package/dist/umd/index.js CHANGED
@@ -11121,7 +11121,7 @@
11121
11121
  var client = __webpack_require__("Q");
11122
11122
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
11123
11123
  var package_namespaceObject = {
11124
- rE: "16.0.1"
11124
+ rE: "16.0.2"
11125
11125
  };
11126
11126
  function isAudioEnabled(options) {
11127
11127
  return Boolean(options.audio.enabled);
@@ -19852,6 +19852,7 @@
19852
19852
  this.options.logger.debug(debugLine);
19853
19853
  const canReconnect = this.canReconnectAfterStreamClose();
19854
19854
  this.connected = false;
19855
+ this.stopPings();
19855
19856
  if (this.shouldIgnoreStreamClose()) return;
19856
19857
  if (this.mediaTransmissionStarted) this.failInterruptedRecording();
19857
19858
  else if (canReconnect) {
@@ -19868,7 +19869,37 @@
19868
19869
  }, 0);
19869
19870
  }
19870
19871
  shouldIgnoreStreamClose() {
19871
- return this.recordingTransportFailed || Boolean(this.unloaded);
19872
+ return this.recordingTransportFailed || Boolean(this.unloaded) || this.validate();
19873
+ }
19874
+ handleStreamError(url2Connect, err) {
19875
+ if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
19876
+ else this.lastSocketError = serializeError(err);
19877
+ const debugLine = string_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
19878
+ error: serializeError(err)
19879
+ });
19880
+ this.options.logger.debug(debugLine);
19881
+ if (this.validate()) {
19882
+ this.connected = false;
19883
+ this.stopPings();
19884
+ this.discardSocket();
19885
+ return;
19886
+ }
19887
+ if (!this.connected) return void this.handleConnectionFailure({
19888
+ url2Connect,
19889
+ cause: "error"
19890
+ });
19891
+ const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
19892
+ cause: this.lastSocketError ?? err
19893
+ });
19894
+ if (this.mediaTransmissionStarted) return void this.failInterruptedRecording();
19895
+ this.emit("ERROR", {
19896
+ err: error_createError({
19897
+ message: "WebSocket stream error",
19898
+ explanation: `The WebSocket stream emitted an error event. Details: ${string_pretty(err)}`,
19899
+ options: this.options,
19900
+ exc: streamError
19901
+ })
19902
+ });
19872
19903
  }
19873
19904
  sendPings() {
19874
19905
  this.stopPings();
@@ -19879,6 +19910,7 @@
19879
19910
  }
19880
19911
  stopPings() {
19881
19912
  if (void 0 === this.pingInterval) return;
19913
+ this.options.logger.debug("Recorder: stopping pings...");
19882
19914
  window.clearInterval(this.pingInterval);
19883
19915
  this.pingInterval = void 0;
19884
19916
  }
@@ -20030,7 +20062,7 @@
20030
20062
  });
20031
20063
  }
20032
20064
  shouldIgnoreConnectionFailure() {
20033
- return this.connectionFailed || this.connected || Boolean(this.unloaded);
20065
+ return this.connectionFailed || this.connected || Boolean(this.unloaded) || this.validate();
20034
20066
  }
20035
20067
  calculateFrameProgress() {
20036
20068
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
@@ -20236,28 +20268,7 @@
20236
20268
  }
20237
20269
  });
20238
20270
  stream.on("error", (err)=>{
20239
- if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
20240
- else this.lastSocketError = serializeError(err);
20241
- const debugLine = string_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
20242
- error: serializeError(err)
20243
- });
20244
- this.options.logger.debug(debugLine);
20245
- if (!this.connected) return void this.handleConnectionFailure({
20246
- url2Connect,
20247
- cause: "error"
20248
- });
20249
- const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
20250
- cause: this.lastSocketError ?? err
20251
- });
20252
- if (this.mediaTransmissionStarted) return void this.failInterruptedRecording();
20253
- this.emit("ERROR", {
20254
- err: error_createError({
20255
- message: "WebSocket stream error",
20256
- explanation: `The WebSocket stream emitted an error event. Details: ${string_pretty(err)}`,
20257
- options: this.options,
20258
- exc: streamError
20259
- })
20260
- });
20271
+ this.handleStreamError(url2Connect, err);
20261
20272
  });
20262
20273
  stream.on("drain", ()=>{
20263
20274
  this.handleStreamDrain(stream);
@@ -20598,6 +20609,7 @@
20598
20609
  }
20599
20610
  back(cb) {
20600
20611
  this.emit("GOING_BACK");
20612
+ this.key = void 0;
20601
20613
  this.recordingDimensions = void 0;
20602
20614
  this.unloaded = false;
20603
20615
  this.show();
@@ -20662,7 +20674,7 @@
20662
20674
  this.stopTimeout = void 0;
20663
20675
  }
20664
20676
  validate() {
20665
- return this.connected && void 0 === this.canvas;
20677
+ return Boolean(this.key) && void 0 === this.canvas;
20666
20678
  }
20667
20679
  isReady() {
20668
20680
  return this.userMedia?.isReady();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "16.0.1",
3
+ "version": "16.0.2",
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",