videomail-client 15.3.3 → 15.4.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.
@@ -11071,7 +11071,7 @@ var __webpack_modules__ = {
11071
11071
  var client = __webpack_require__(5734);
11072
11072
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
11073
11073
  var package_namespaceObject = {
11074
- rE: "15.3.3"
11074
+ rE: "15.4.0"
11075
11075
  };
11076
11076
  function isAudioEnabled(options) {
11077
11077
  return Boolean(options.audio.enabled);
@@ -17744,6 +17744,30 @@ var __webpack_modules__ = {
17744
17744
  window.clearTimeout(this.retryTimeout);
17745
17745
  this.retryTimeout = void 0;
17746
17746
  }
17747
+ clearConnectionTimeout() {
17748
+ if (!this.connectionTimeout) return;
17749
+ this.options.logger.debug("Recorder: clearConnectionTimeout()");
17750
+ window.clearTimeout(this.connectionTimeout);
17751
+ this.connectionTimeout = void 0;
17752
+ }
17753
+ failConnection(params) {
17754
+ if (this.connectionFailed || this.connected || this.unloaded) return;
17755
+ this.connectionFailed = true;
17756
+ this.connecting = false;
17757
+ this.clearConnectionTimeout();
17758
+ if (this.stream) {
17759
+ this.stream.destroy();
17760
+ this.stream = void 0;
17761
+ }
17762
+ const err = error_createError({
17763
+ message: "Unable to connect to the server",
17764
+ explanation: params.explanation,
17765
+ options: this.options
17766
+ });
17767
+ this.emit("ERROR", {
17768
+ err
17769
+ });
17770
+ }
17747
17771
  calculateFrameProgress() {
17748
17772
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
17749
17773
  }
@@ -17816,6 +17840,7 @@ var __webpack_modules__ = {
17816
17840
  initSocket(cb) {
17817
17841
  if (!this.connected) {
17818
17842
  this.connecting = true;
17843
+ this.connectionFailed = false;
17819
17844
  this.emit("CONNECTING");
17820
17845
  let url2Connect;
17821
17846
  try {
@@ -17870,17 +17895,28 @@ var __webpack_modules__ = {
17870
17895
  });
17871
17896
  }
17872
17897
  if (this.stream) {
17873
- this.stream.on("close", (err)=>{
17898
+ const connectionTimeoutMs = this.options.timeouts.connection;
17899
+ this.connectionTimeout = window.setTimeout(()=>{
17900
+ this.failConnection({
17901
+ url2Connect,
17902
+ explanation: `The server at ${url2Connect} did not respond within ${connectionTimeoutMs}ms. Please check your internet connection and try again. If the problem persists, contact us.`
17903
+ });
17904
+ }, connectionTimeoutMs);
17905
+ this.stream.on("close", ()=>{
17874
17906
  this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`);
17907
+ const neverConnected = this.connecting && !this.connected;
17908
+ this.clearConnectionTimeout();
17875
17909
  this.connecting = this.connected = false;
17876
- if (err) this.emit("ERROR", {
17877
- err
17910
+ if (neverConnected) this.failConnection({
17911
+ url2Connect,
17912
+ explanation: `The connection to ${url2Connect} was refused or could not be reached. Please check your internet connection and try again. If the problem persists, contact us.`
17878
17913
  });
17879
17914
  else if (this.userMediaLoaded) this.initSocket();
17880
17915
  });
17881
17916
  this.stream.on("connect", ()=>{
17882
17917
  var _this_stream;
17883
17918
  this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`);
17919
+ this.clearConnectionTimeout();
17884
17920
  const isClosing = (null == (_this_stream = this.stream) ? void 0 : _this_stream.socket.readyState) === WebSocket.CLOSING;
17885
17921
  if (!this.connected && !isClosing && !this.unloaded) {
17886
17922
  this.connected = true;
@@ -18245,6 +18281,8 @@ var __webpack_modules__ = {
18245
18281
  this.options.logger.debug(`Recorder: unload()${prettyCause}`);
18246
18282
  this.reset();
18247
18283
  this.clearUserMediaTimeout();
18284
+ this.clearConnectionTimeout();
18285
+ this.connecting = false;
18248
18286
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
18249
18287
  if (this.submitting) ;
18250
18288
  else if (this.stream) {
@@ -18656,7 +18694,7 @@ var __webpack_modules__ = {
18656
18694
  return this.userMediaLoaded;
18657
18695
  }
18658
18696
  constructor(visuals, replay, options){
18659
- 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, "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, "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, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
18697
+ 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, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
18660
18698
  this.visuals = visuals;
18661
18699
  this.replay = replay;
18662
18700
  this.facingMode = options.video.facingMode;
package/dist/esm/index.js CHANGED
@@ -3621,7 +3621,7 @@ const constants = {
3621
3621
  }
3622
3622
  };
3623
3623
  var package_namespaceObject = {
3624
- rE: "15.3.3"
3624
+ rE: "15.4.0"
3625
3625
  };
3626
3626
  function isAudioEnabled(options) {
3627
3627
  return Boolean(options.audio.enabled);
@@ -6636,6 +6636,30 @@ class Recorder extends util_Despot {
6636
6636
  window.clearTimeout(this.retryTimeout);
6637
6637
  this.retryTimeout = void 0;
6638
6638
  }
6639
+ clearConnectionTimeout() {
6640
+ if (!this.connectionTimeout) return;
6641
+ this.options.logger.debug("Recorder: clearConnectionTimeout()");
6642
+ window.clearTimeout(this.connectionTimeout);
6643
+ this.connectionTimeout = void 0;
6644
+ }
6645
+ failConnection(params) {
6646
+ if (this.connectionFailed || this.connected || this.unloaded) return;
6647
+ this.connectionFailed = true;
6648
+ this.connecting = false;
6649
+ this.clearConnectionTimeout();
6650
+ if (this.stream) {
6651
+ this.stream.destroy();
6652
+ this.stream = void 0;
6653
+ }
6654
+ const err = error_createError({
6655
+ message: "Unable to connect to the server",
6656
+ explanation: params.explanation,
6657
+ options: this.options
6658
+ });
6659
+ this.emit("ERROR", {
6660
+ err
6661
+ });
6662
+ }
6639
6663
  calculateFrameProgress() {
6640
6664
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
6641
6665
  }
@@ -6707,6 +6731,7 @@ class Recorder extends util_Despot {
6707
6731
  initSocket(cb) {
6708
6732
  if (!this.connected) {
6709
6733
  this.connecting = true;
6734
+ this.connectionFailed = false;
6710
6735
  this.emit("CONNECTING");
6711
6736
  let url2Connect;
6712
6737
  try {
@@ -6761,16 +6786,27 @@ class Recorder extends util_Despot {
6761
6786
  });
6762
6787
  }
6763
6788
  if (this.stream) {
6764
- this.stream.on("close", (err)=>{
6789
+ const connectionTimeoutMs = this.options.timeouts.connection;
6790
+ this.connectionTimeout = window.setTimeout(()=>{
6791
+ this.failConnection({
6792
+ url2Connect,
6793
+ explanation: `The server at ${url2Connect} did not respond within ${connectionTimeoutMs}ms. Please check your internet connection and try again. If the problem persists, contact us.`
6794
+ });
6795
+ }, connectionTimeoutMs);
6796
+ this.stream.on("close", ()=>{
6765
6797
  this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`);
6798
+ const neverConnected = this.connecting && !this.connected;
6799
+ this.clearConnectionTimeout();
6766
6800
  this.connecting = this.connected = false;
6767
- if (err) this.emit("ERROR", {
6768
- err
6801
+ if (neverConnected) this.failConnection({
6802
+ url2Connect,
6803
+ explanation: `The connection to ${url2Connect} was refused or could not be reached. Please check your internet connection and try again. If the problem persists, contact us.`
6769
6804
  });
6770
6805
  else if (this.userMediaLoaded) this.initSocket();
6771
6806
  });
6772
6807
  this.stream.on("connect", ()=>{
6773
6808
  this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`);
6809
+ this.clearConnectionTimeout();
6774
6810
  const isClosing = this.stream?.socket.readyState === WebSocket.CLOSING;
6775
6811
  if (!this.connected && !isClosing && !this.unloaded) {
6776
6812
  this.connected = true;
@@ -7129,6 +7165,8 @@ class Recorder extends util_Despot {
7129
7165
  this.options.logger.debug(`Recorder: unload()${prettyCause}`);
7130
7166
  this.reset();
7131
7167
  this.clearUserMediaTimeout();
7168
+ this.clearConnectionTimeout();
7169
+ this.connecting = false;
7132
7170
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
7133
7171
  if (this.submitting) ;
7134
7172
  else if (this.stream) {
@@ -7531,7 +7569,7 @@ class Recorder extends util_Despot {
7531
7569
  return this.userMediaLoaded;
7532
7570
  }
7533
7571
  constructor(visuals, replay, options){
7534
- 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, "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, "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, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
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, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
7535
7573
  this.visuals = visuals;
7536
7574
  this.replay = replay;
7537
7575
  this.facingMode = options.video.facingMode;
@@ -25,6 +25,7 @@ declare class Recorder extends Despot {
25
25
  private userMedia?;
26
26
  private userMediaTimeout?;
27
27
  private retryTimeout?;
28
+ private connectionTimeout?;
28
29
  private frameProgress?;
29
30
  private sampleProgress?;
30
31
  private canvas?;
@@ -37,6 +38,7 @@ declare class Recorder extends Despot {
37
38
  private stream?;
38
39
  private connecting;
39
40
  private connected;
41
+ private connectionFailed;
40
42
  private blocking;
41
43
  private built;
42
44
  private key?;
@@ -53,6 +55,8 @@ declare class Recorder extends Despot {
53
55
  show(): void;
54
56
  private onUserMediaReady;
55
57
  private clearRetryTimeout;
58
+ private clearConnectionTimeout;
59
+ private failConnection;
56
60
  private calculateFrameProgress;
57
61
  private calculateSampleProgress;
58
62
  private updateOverallProgress;
package/dist/umd/index.js CHANGED
@@ -11495,7 +11495,7 @@
11495
11495
  var client = __webpack_require__(5734);
11496
11496
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
11497
11497
  var package_namespaceObject = {
11498
- rE: "15.3.3"
11498
+ rE: "15.4.0"
11499
11499
  };
11500
11500
  function isAudioEnabled(options) {
11501
11501
  return Boolean(options.audio.enabled);
@@ -17789,6 +17789,7 @@
17789
17789
  userMedia;
17790
17790
  userMediaTimeout;
17791
17791
  retryTimeout;
17792
+ connectionTimeout;
17792
17793
  frameProgress;
17793
17794
  sampleProgress;
17794
17795
  canvas;
@@ -17801,6 +17802,7 @@
17801
17802
  stream;
17802
17803
  connecting = false;
17803
17804
  connected = false;
17805
+ connectionFailed = false;
17804
17806
  blocking = false;
17805
17807
  built = false;
17806
17808
  key;
@@ -17901,6 +17903,30 @@
17901
17903
  window.clearTimeout(this.retryTimeout);
17902
17904
  this.retryTimeout = void 0;
17903
17905
  }
17906
+ clearConnectionTimeout() {
17907
+ if (!this.connectionTimeout) return;
17908
+ this.options.logger.debug("Recorder: clearConnectionTimeout()");
17909
+ window.clearTimeout(this.connectionTimeout);
17910
+ this.connectionTimeout = void 0;
17911
+ }
17912
+ failConnection(params) {
17913
+ if (this.connectionFailed || this.connected || this.unloaded) return;
17914
+ this.connectionFailed = true;
17915
+ this.connecting = false;
17916
+ this.clearConnectionTimeout();
17917
+ if (this.stream) {
17918
+ this.stream.destroy();
17919
+ this.stream = void 0;
17920
+ }
17921
+ const err = error_createError({
17922
+ message: "Unable to connect to the server",
17923
+ explanation: params.explanation,
17924
+ options: this.options
17925
+ });
17926
+ this.emit("ERROR", {
17927
+ err
17928
+ });
17929
+ }
17904
17930
  calculateFrameProgress() {
17905
17931
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
17906
17932
  }
@@ -17972,6 +17998,7 @@
17972
17998
  initSocket(cb) {
17973
17999
  if (!this.connected) {
17974
18000
  this.connecting = true;
18001
+ this.connectionFailed = false;
17975
18002
  this.emit("CONNECTING");
17976
18003
  let url2Connect;
17977
18004
  try {
@@ -18026,16 +18053,27 @@
18026
18053
  });
18027
18054
  }
18028
18055
  if (this.stream) {
18029
- this.stream.on("close", (err)=>{
18056
+ const connectionTimeoutMs = this.options.timeouts.connection;
18057
+ this.connectionTimeout = window.setTimeout(()=>{
18058
+ this.failConnection({
18059
+ url2Connect,
18060
+ explanation: `The server at ${url2Connect} did not respond within ${connectionTimeoutMs}ms. Please check your internet connection and try again. If the problem persists, contact us.`
18061
+ });
18062
+ }, connectionTimeoutMs);
18063
+ this.stream.on("close", ()=>{
18030
18064
  this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`);
18065
+ const neverConnected = this.connecting && !this.connected;
18066
+ this.clearConnectionTimeout();
18031
18067
  this.connecting = this.connected = false;
18032
- if (err) this.emit("ERROR", {
18033
- err
18068
+ if (neverConnected) this.failConnection({
18069
+ url2Connect,
18070
+ explanation: `The connection to ${url2Connect} was refused or could not be reached. Please check your internet connection and try again. If the problem persists, contact us.`
18034
18071
  });
18035
18072
  else if (this.userMediaLoaded) this.initSocket();
18036
18073
  });
18037
18074
  this.stream.on("connect", ()=>{
18038
18075
  this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`);
18076
+ this.clearConnectionTimeout();
18039
18077
  const isClosing = this.stream?.socket.readyState === WebSocket.CLOSING;
18040
18078
  if (!this.connected && !isClosing && !this.unloaded) {
18041
18079
  this.connected = true;
@@ -18394,6 +18432,8 @@
18394
18432
  this.options.logger.debug(`Recorder: unload()${prettyCause}`);
18395
18433
  this.reset();
18396
18434
  this.clearUserMediaTimeout();
18435
+ this.clearConnectionTimeout();
18436
+ this.connecting = false;
18397
18437
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
18398
18438
  if (this.submitting) ;
18399
18439
  else if (this.stream) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "15.3.3",
3
+ "version": "15.4.0",
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",
@@ -90,20 +90,20 @@
90
90
  "@tsconfig/node26": "26.0.1",
91
91
  "@tsconfig/strictest": "2.0.8",
92
92
  "@types/defined": "1.0.2",
93
- "@types/node": "26.4.1",
93
+ "@types/node": "26.5.0",
94
94
  "@types/superagent": "8.1.11",
95
95
  "@types/ua-parser-js": "0.7.39",
96
96
  "@vitest/eslint-plugin": "1.6.27",
97
97
  "audit-ci": "7.1.0",
98
98
  "chromatic": "18.7.2",
99
99
  "cross-env": "10.1.0",
100
- "eslint": "10.9.1",
100
+ "eslint": "10.10.0",
101
101
  "eslint-import-resolver-typescript": "4.4.5",
102
102
  "eslint-plugin-de-morgan": "2.1.3",
103
103
  "eslint-plugin-depend": "1.5.0",
104
104
  "eslint-plugin-import-x": "4.17.1",
105
105
  "eslint-plugin-package-json": "1.8.0",
106
- "eslint-plugin-regexp": "3.2.0",
106
+ "eslint-plugin-regexp": "3.3.0",
107
107
  "eslint-plugin-simple-import-sort": "14.0.0",
108
108
  "globals": "17.12.0",
109
109
  "jsdom": "30.0.1",
@@ -119,7 +119,7 @@
119
119
  "storybook-html-rsbuild": "3.4.2",
120
120
  "type-fest": "5.9.0",
121
121
  "typescript": "6.0.3",
122
- "typescript-eslint": "8.69.0",
122
+ "typescript-eslint": "8.70.0",
123
123
  "vitest": "4.1.11"
124
124
  },
125
125
  "engines": {