videomail-client 15.8.1 → 15.8.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/dist/cjs/index.cjs +241 -231
- package/dist/esm/index.js +223 -214
- package/dist/esm/{util/html/media → media}/canPlayType.d.ts +1 -1
- package/dist/esm/util/error/createError.d.ts +1 -0
- package/dist/umd/index.js +238 -229
- package/package.json +8 -8
- /package/dist/esm/{util/html/media → media}/getFirstVideoTrack.d.ts +0 -0
- /package/dist/esm/{util/html/media → media}/mediaEvents.d.ts +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -3620,7 +3620,7 @@ const constants = {
|
|
|
3620
3620
|
}
|
|
3621
3621
|
};
|
|
3622
3622
|
var package_namespaceObject = {
|
|
3623
|
-
rE: "15.8.
|
|
3623
|
+
rE: "15.8.2"
|
|
3624
3624
|
};
|
|
3625
3625
|
function isAudioEnabled(options) {
|
|
3626
3626
|
return Boolean(options.audio.enabled);
|
|
@@ -3991,6 +3991,7 @@ function createError(errorParams) {
|
|
|
3991
3991
|
].filter(Boolean).join(", ");
|
|
3992
3992
|
options.logger.debug(`VideomailError: create(${args})`);
|
|
3993
3993
|
const errData = {
|
|
3994
|
+
cause: errorParams.cause,
|
|
3994
3995
|
explanation,
|
|
3995
3996
|
logLines,
|
|
3996
3997
|
err
|
|
@@ -4118,12 +4119,12 @@ function showElement(element) {
|
|
|
4118
4119
|
element.style.removeProperty("display");
|
|
4119
4120
|
}
|
|
4120
4121
|
const html_showElement = showElement;
|
|
4121
|
-
const
|
|
4122
|
+
const EMAIL_SEPARATOR_REGEX = /[ ,]+/gu;
|
|
4122
4123
|
function trimEmail(email) {
|
|
4123
|
-
return email.replace(
|
|
4124
|
+
return email.replace(EMAIL_SEPARATOR_REGEX, "");
|
|
4124
4125
|
}
|
|
4125
4126
|
function trimEmails(emails) {
|
|
4126
|
-
const trimmedEmails = emails.split(
|
|
4127
|
+
const trimmedEmails = emails.split(EMAIL_SEPARATOR_REGEX).map((item)=>item.trim()).filter(Boolean);
|
|
4127
4128
|
return trimmedEmails;
|
|
4128
4129
|
}
|
|
4129
4130
|
function form_define_property(obj, key, value) {
|
|
@@ -4499,6 +4500,7 @@ class Resource {
|
|
|
4499
4500
|
browser: err.browser,
|
|
4500
4501
|
code: err.code,
|
|
4501
4502
|
cookie: err.cookie,
|
|
4503
|
+
cause: err.cause instanceof Error ? serializeError(err.cause) : err.cause,
|
|
4502
4504
|
cpu: err.cpu,
|
|
4503
4505
|
device: err.device,
|
|
4504
4506
|
engine: err.engine,
|
|
@@ -6158,6 +6160,34 @@ function summarize(title, contents) {
|
|
|
6158
6160
|
return line;
|
|
6159
6161
|
}
|
|
6160
6162
|
const util_summarize = summarize;
|
|
6163
|
+
function getFirstVideoTrack(localMediaStream) {
|
|
6164
|
+
const videoTracks = localMediaStream.getVideoTracks();
|
|
6165
|
+
let videoTrack;
|
|
6166
|
+
if (videoTracks[0]) videoTrack = videoTracks[0];
|
|
6167
|
+
return videoTrack;
|
|
6168
|
+
}
|
|
6169
|
+
const media_getFirstVideoTrack = getFirstVideoTrack;
|
|
6170
|
+
const MEDIA_EVENTS = [
|
|
6171
|
+
"loadstart",
|
|
6172
|
+
"suspend",
|
|
6173
|
+
"progress",
|
|
6174
|
+
"abort",
|
|
6175
|
+
"emptied",
|
|
6176
|
+
"stalled",
|
|
6177
|
+
"pause",
|
|
6178
|
+
"loadeddata",
|
|
6179
|
+
"waiting",
|
|
6180
|
+
"playing",
|
|
6181
|
+
"canplay",
|
|
6182
|
+
"canplaythrough",
|
|
6183
|
+
"seeking",
|
|
6184
|
+
"seeked",
|
|
6185
|
+
"ended",
|
|
6186
|
+
"ratechange",
|
|
6187
|
+
"durationchange",
|
|
6188
|
+
"volumechange"
|
|
6189
|
+
];
|
|
6190
|
+
const mediaEvents = MEDIA_EVENTS;
|
|
6161
6191
|
function AudioRecorder_define_property(obj, key, value) {
|
|
6162
6192
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
6163
6193
|
value: value,
|
|
@@ -6203,11 +6233,11 @@ class AudioRecorder {
|
|
|
6203
6233
|
let { bufferSize } = this.options.audio;
|
|
6204
6234
|
if ("auto" === bufferSize) bufferSize = util_getBrowser(this.options).isFirefox() ? 512 : 2048;
|
|
6205
6235
|
if (!is_power_of_two(bufferSize)) throw error_createError({
|
|
6206
|
-
message:
|
|
6236
|
+
message: `Audio buffer size must be a power of two. The current buffer size is ${bufferSize}.`,
|
|
6207
6237
|
options: this.options
|
|
6208
6238
|
});
|
|
6209
|
-
if (this.options.audio.volume < 0 || this.options.audio.volume > 1) throw error_createError({
|
|
6210
|
-
message:
|
|
6239
|
+
if (!Number.isFinite(this.options.audio.volume) || this.options.audio.volume < 0 || this.options.audio.volume > 1) throw error_createError({
|
|
6240
|
+
message: `Audio volume must be between zero and one. The current volume is ${this.options.audio.volume}.`,
|
|
6211
6241
|
options: this.options
|
|
6212
6242
|
});
|
|
6213
6243
|
volume.gain.value = this.options.audio.volume;
|
|
@@ -6253,34 +6283,6 @@ class AudioRecorder {
|
|
|
6253
6283
|
}
|
|
6254
6284
|
}
|
|
6255
6285
|
const media_AudioRecorder = AudioRecorder;
|
|
6256
|
-
function getFirstVideoTrack(localMediaStream) {
|
|
6257
|
-
const videoTracks = localMediaStream.getVideoTracks();
|
|
6258
|
-
let videoTrack;
|
|
6259
|
-
if (videoTracks[0]) videoTrack = videoTracks[0];
|
|
6260
|
-
return videoTrack;
|
|
6261
|
-
}
|
|
6262
|
-
const media_getFirstVideoTrack = getFirstVideoTrack;
|
|
6263
|
-
const MEDIA_EVENTS = [
|
|
6264
|
-
"loadstart",
|
|
6265
|
-
"suspend",
|
|
6266
|
-
"progress",
|
|
6267
|
-
"abort",
|
|
6268
|
-
"emptied",
|
|
6269
|
-
"stalled",
|
|
6270
|
-
"pause",
|
|
6271
|
-
"loadeddata",
|
|
6272
|
-
"waiting",
|
|
6273
|
-
"playing",
|
|
6274
|
-
"canplay",
|
|
6275
|
-
"canplaythrough",
|
|
6276
|
-
"seeking",
|
|
6277
|
-
"seeked",
|
|
6278
|
-
"ended",
|
|
6279
|
-
"ratechange",
|
|
6280
|
-
"durationchange",
|
|
6281
|
-
"volumechange"
|
|
6282
|
-
];
|
|
6283
|
-
const mediaEvents = MEDIA_EVENTS;
|
|
6284
6286
|
const VIRTUAL_KEYWORDS = [
|
|
6285
6287
|
"obs",
|
|
6286
6288
|
"virtual",
|
|
@@ -6684,6 +6686,7 @@ class Recorder extends util_Despot {
|
|
|
6684
6686
|
const switchingFacingMode = params?.switchingFacingMode;
|
|
6685
6687
|
this.userMediaLoading = this.blocking = this.unloaded = this.submitting = false;
|
|
6686
6688
|
this.userMediaLoaded = true;
|
|
6689
|
+
this.clearUserMediaTimeout();
|
|
6687
6690
|
if (!switchingFacingMode) this.loop = this.createLoop();
|
|
6688
6691
|
this.show();
|
|
6689
6692
|
if (params?.recordWhenReady) this.record();
|
|
@@ -6729,12 +6732,17 @@ class Recorder extends util_Despot {
|
|
|
6729
6732
|
closeReason: closeEvent?.reason,
|
|
6730
6733
|
elapsedMs,
|
|
6731
6734
|
online,
|
|
6735
|
+
secureContext: globalThis.isSecureContext,
|
|
6736
|
+
socketReadyState: this.stream?.socket.readyState,
|
|
6737
|
+
timeoutMs: this.options.timeouts.connection,
|
|
6738
|
+
url: url2Connect,
|
|
6732
6739
|
unloaded: this.unloaded,
|
|
6733
6740
|
userMediaLoaded: this.userMediaLoaded,
|
|
6734
6741
|
userMediaLoading: this.userMediaLoading,
|
|
6735
6742
|
wasClean: closeEvent?.wasClean,
|
|
6736
6743
|
socketError,
|
|
6737
|
-
blocking: this.blocking
|
|
6744
|
+
blocking: this.blocking,
|
|
6745
|
+
visibilityState: document.visibilityState
|
|
6738
6746
|
};
|
|
6739
6747
|
const debugLine = util_summarize("Recorder: failConnection() diagnostic", contents);
|
|
6740
6748
|
this.options.logger.debug(debugLine);
|
|
@@ -6754,6 +6762,7 @@ class Recorder extends util_Despot {
|
|
|
6754
6762
|
message: "Unable to connect to the server",
|
|
6755
6763
|
explanation,
|
|
6756
6764
|
options: this.options,
|
|
6765
|
+
cause: contents,
|
|
6757
6766
|
exc: socketError ? new Error("WebSocket connection error", {
|
|
6758
6767
|
cause: socketError
|
|
6759
6768
|
}) : void 0
|
|
@@ -6831,195 +6840,195 @@ class Recorder extends util_Despot {
|
|
|
6831
6840
|
this.recordingStats.waitingTime = this.waitingTime;
|
|
6832
6841
|
}
|
|
6833
6842
|
initSocket(cb) {
|
|
6834
|
-
if (
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
}
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
}
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
}
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
}, connectionTimeoutMs);
|
|
6919
|
-
this.stream.on("close", ()=>{
|
|
6920
|
-
const debugLine = util_summarize(`${PIPE_SYMBOL}Stream has closed:`, {
|
|
6921
|
-
connecting: this.connecting,
|
|
6922
|
-
connected: this.connected,
|
|
6923
|
-
userMediaLoaded: this.userMediaLoaded,
|
|
6924
|
-
blocking: this.blocking
|
|
6925
|
-
});
|
|
6926
|
-
this.options.logger.debug(debugLine);
|
|
6927
|
-
const tryReconnect = this.connected && this.userMediaLoaded;
|
|
6928
|
-
this.connected = false;
|
|
6929
|
-
if (tryReconnect) this.initSocket();
|
|
6930
|
-
else if (!this.connecting && !this.blocking) window.setTimeout(()=>{
|
|
6931
|
-
this.failConnection({
|
|
6932
|
-
url2Connect,
|
|
6933
|
-
cause: "closed"
|
|
6934
|
-
});
|
|
6935
|
-
}, 0);
|
|
6936
|
-
});
|
|
6937
|
-
this.stream.on("connect", (args)=>{
|
|
6938
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted with args: ${util_pretty(args)}`);
|
|
6939
|
-
this.clearConnectionTimeout();
|
|
6940
|
-
const isClosing = this.stream?.socket.readyState === WebSocket.CLOSING;
|
|
6941
|
-
if (!this.connected && !isClosing && !this.unloaded) {
|
|
6942
|
-
this.connected = true;
|
|
6943
|
-
this.connecting = this.unloaded = false;
|
|
6944
|
-
this.emit("CONNECTED");
|
|
6945
|
-
cb?.();
|
|
6946
|
-
}
|
|
6843
|
+
if (this.connected) return void cb?.();
|
|
6844
|
+
if (this.connecting) return;
|
|
6845
|
+
if (util_isAutomatedUserAgent()) {
|
|
6846
|
+
this.connecting = false;
|
|
6847
|
+
this.options.logger.debug("Recorder: skipping web socket connection for an automated crawler");
|
|
6848
|
+
return;
|
|
6849
|
+
}
|
|
6850
|
+
this.connecting = true;
|
|
6851
|
+
this.connectionFailed = false;
|
|
6852
|
+
this.connectingStartedAt = Date.now();
|
|
6853
|
+
this.lastCloseEvent = void 0;
|
|
6854
|
+
this.lastSocketError = void 0;
|
|
6855
|
+
this.emit("CONNECTING");
|
|
6856
|
+
let url2Connect;
|
|
6857
|
+
try {
|
|
6858
|
+
const socketUrlObj = new URL(this.options.socketUrl);
|
|
6859
|
+
socketUrlObj.searchParams.set(constants.WHITELIST_KEY_LABEL, this.options.whitelistKey);
|
|
6860
|
+
url2Connect = socketUrlObj.toString();
|
|
6861
|
+
} catch (exc) {
|
|
6862
|
+
this.connecting = this.connected = false;
|
|
6863
|
+
const err = error_createError({
|
|
6864
|
+
message: "Invalid WebSocket URL",
|
|
6865
|
+
explanation: `The configured socketUrl "${this.options.socketUrl}" is not a valid URL. Please check your videomail-client configuration.`,
|
|
6866
|
+
options: this.options,
|
|
6867
|
+
exc
|
|
6868
|
+
});
|
|
6869
|
+
this.emit("ERROR", {
|
|
6870
|
+
err
|
|
6871
|
+
});
|
|
6872
|
+
return;
|
|
6873
|
+
}
|
|
6874
|
+
this.options.logger.debug(`Recorder: initializing web socket stream to ${url2Connect}`);
|
|
6875
|
+
let nativeSocket;
|
|
6876
|
+
try {
|
|
6877
|
+
nativeSocket = new WebSocket(url2Connect);
|
|
6878
|
+
nativeSocket.addEventListener("close", (event)=>{
|
|
6879
|
+
this.lastCloseEvent = {
|
|
6880
|
+
code: event.code,
|
|
6881
|
+
reason: event.reason,
|
|
6882
|
+
wasClean: event.wasClean
|
|
6883
|
+
};
|
|
6884
|
+
});
|
|
6885
|
+
nativeSocket.addEventListener("error", (event)=>{
|
|
6886
|
+
this.lastSocketError = error_getEventDetails(event);
|
|
6887
|
+
});
|
|
6888
|
+
} catch (exc) {
|
|
6889
|
+
this.connecting = this.connected = false;
|
|
6890
|
+
const diagnostic = error_getWebSocketDiagnostic(url2Connect);
|
|
6891
|
+
const message = diagnostic.looksAutomated ? "Automated crawler: WebSocket not supported in this environment" : `Failed to construct WebSocket to ${url2Connect}`;
|
|
6892
|
+
const explanation = diagnostic.looksAutomated ? "Headless crawlers cannot use Videomail's WebSocket. No action needed." : `Please check your connection and try again. If the problem persists, contact us. Diagnostic: ${diagnostic.text}`;
|
|
6893
|
+
const err = error_createError({
|
|
6894
|
+
message,
|
|
6895
|
+
explanation,
|
|
6896
|
+
options: this.options,
|
|
6897
|
+
exc
|
|
6898
|
+
});
|
|
6899
|
+
this.emit("ERROR", {
|
|
6900
|
+
err
|
|
6901
|
+
});
|
|
6902
|
+
return;
|
|
6903
|
+
}
|
|
6904
|
+
try {
|
|
6905
|
+
this.stream = websocket_stream(nativeSocket);
|
|
6906
|
+
} catch (exc) {
|
|
6907
|
+
this.connecting = this.connected = false;
|
|
6908
|
+
const err = error_createError({
|
|
6909
|
+
message: `Failed to create a stream to ${url2Connect}`,
|
|
6910
|
+
explanation: "Please check your connection and try again. If the problem persists, contact us.",
|
|
6911
|
+
options: this.options,
|
|
6912
|
+
exc
|
|
6913
|
+
});
|
|
6914
|
+
this.emit("ERROR", {
|
|
6915
|
+
err
|
|
6916
|
+
});
|
|
6917
|
+
}
|
|
6918
|
+
if (this.stream) {
|
|
6919
|
+
const connectionTimeoutMs = this.options.timeouts.connection;
|
|
6920
|
+
this.connectionTimeout = window.setTimeout(()=>{
|
|
6921
|
+
if (this.isOnline() && this.isUserMediaLoaded()) {
|
|
6922
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Reconnecting due to connection timeout.`);
|
|
6923
|
+
this.initSocket();
|
|
6924
|
+
} else this.failConnection({
|
|
6925
|
+
url2Connect,
|
|
6926
|
+
cause: "timeout"
|
|
6947
6927
|
});
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
const err = error_createError({
|
|
6956
|
-
message: "Invalid server command",
|
|
6957
|
-
explanation: `Contact us. The invalid command was: ${data.toString()}.`,
|
|
6958
|
-
options: this.options,
|
|
6959
|
-
exc
|
|
6960
|
-
});
|
|
6961
|
-
this.emit("ERROR", {
|
|
6962
|
-
err
|
|
6963
|
-
});
|
|
6964
|
-
}
|
|
6928
|
+
}, connectionTimeoutMs);
|
|
6929
|
+
this.stream.on("close", ()=>{
|
|
6930
|
+
const debugLine = util_summarize(`${PIPE_SYMBOL}Stream has closed:`, {
|
|
6931
|
+
connecting: this.connecting,
|
|
6932
|
+
connected: this.connected,
|
|
6933
|
+
userMediaLoaded: this.userMediaLoaded,
|
|
6934
|
+
blocking: this.blocking
|
|
6965
6935
|
});
|
|
6966
|
-
this.
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
this.options.logger.debug(debugLine);
|
|
6973
|
-
if (!this.connected) return void this.failConnection({
|
|
6936
|
+
this.options.logger.debug(debugLine);
|
|
6937
|
+
const tryReconnect = this.connected && this.userMediaLoaded;
|
|
6938
|
+
this.connected = false;
|
|
6939
|
+
if (tryReconnect) this.initSocket();
|
|
6940
|
+
else if (!this.connecting && !this.blocking) window.setTimeout(()=>{
|
|
6941
|
+
this.failConnection({
|
|
6974
6942
|
url2Connect,
|
|
6975
|
-
cause: "
|
|
6943
|
+
cause: "closed"
|
|
6976
6944
|
});
|
|
6977
|
-
|
|
6978
|
-
|
|
6945
|
+
}, 0);
|
|
6946
|
+
});
|
|
6947
|
+
this.stream.on("connect", (args)=>{
|
|
6948
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted with args: ${util_pretty(args)}`);
|
|
6949
|
+
this.clearConnectionTimeout();
|
|
6950
|
+
const isClosing = this.stream?.socket.readyState === WebSocket.CLOSING;
|
|
6951
|
+
if (!this.connected && !isClosing && !this.unloaded) {
|
|
6952
|
+
this.connected = true;
|
|
6953
|
+
this.connecting = this.unloaded = false;
|
|
6954
|
+
this.emit("CONNECTED");
|
|
6955
|
+
cb?.();
|
|
6956
|
+
}
|
|
6957
|
+
});
|
|
6958
|
+
this.stream.on("data", (data)=>{
|
|
6959
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *data* event emitted`);
|
|
6960
|
+
try {
|
|
6961
|
+
const command = JSON.parse(data.toString());
|
|
6962
|
+
this.executeCommand(command);
|
|
6963
|
+
} catch (exc) {
|
|
6964
|
+
this.options.logger.error(`Failed to parse command: ${exc}`);
|
|
6965
|
+
const err = error_createError({
|
|
6966
|
+
message: "Invalid server command",
|
|
6967
|
+
explanation: `Contact us. The invalid command was: ${data.toString()}.`,
|
|
6968
|
+
options: this.options,
|
|
6969
|
+
exc
|
|
6979
6970
|
});
|
|
6980
6971
|
this.emit("ERROR", {
|
|
6981
|
-
err
|
|
6982
|
-
message: "WebSocket stream error",
|
|
6983
|
-
explanation: `The WebSocket stream emitted an error event. Details: ${util_pretty(err)}`,
|
|
6984
|
-
options: this.options,
|
|
6985
|
-
exc: streamError
|
|
6986
|
-
})
|
|
6972
|
+
err
|
|
6987
6973
|
});
|
|
6974
|
+
}
|
|
6975
|
+
});
|
|
6976
|
+
this.stream.on("error", (err)=>{
|
|
6977
|
+
if ("u" > typeof Event && err instanceof Event) this.lastSocketError = error_getEventDetails(err);
|
|
6978
|
+
else this.lastSocketError = serializeError(err);
|
|
6979
|
+
const debugLine = util_summarize(`${PIPE_SYMBOL}Stream *error* event emitted:`, {
|
|
6980
|
+
error: serializeError(err)
|
|
6988
6981
|
});
|
|
6989
|
-
this.
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *preend* event emitted with args: ${util_pretty(args)}`);
|
|
6994
|
-
});
|
|
6995
|
-
this.stream.on("end", ()=>{
|
|
6996
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *end* event emitted`);
|
|
6997
|
-
});
|
|
6998
|
-
this.stream.on("drain", (args)=>{
|
|
6999
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *drain* event emitted with args: ${util_pretty(args)}`);
|
|
7000
|
-
});
|
|
7001
|
-
this.stream.on("pipe", (src)=>{
|
|
7002
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *pipe* event emitted with src: ${util_pretty(src)}`);
|
|
7003
|
-
});
|
|
7004
|
-
this.stream.on("unpipe", (src)=>{
|
|
7005
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *unpipe* event emitted with src: ${util_pretty(src)}`);
|
|
7006
|
-
});
|
|
7007
|
-
this.stream.on("resume", (args)=>{
|
|
7008
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *resume* event emitted with args: ${util_pretty(args)}`);
|
|
7009
|
-
});
|
|
7010
|
-
this.stream.on("uncork", (args)=>{
|
|
7011
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *uncork* event emitted with args: ${util_pretty(args)}`);
|
|
7012
|
-
});
|
|
7013
|
-
this.stream.on("readable", (args)=>{
|
|
7014
|
-
this.options.logger.debug(`${PIPE_SYMBOL}Stream *readable* event emitted with args: ${util_pretty(args)}`);
|
|
6982
|
+
this.options.logger.debug(debugLine);
|
|
6983
|
+
if (!this.connected) return void this.failConnection({
|
|
6984
|
+
url2Connect,
|
|
6985
|
+
cause: "error"
|
|
7015
6986
|
});
|
|
7016
|
-
|
|
7017
|
-
this.
|
|
6987
|
+
const streamError = err instanceof Error ? err : new Error("WebSocket stream emitted an error event", {
|
|
6988
|
+
cause: this.lastSocketError ?? err
|
|
7018
6989
|
});
|
|
7019
|
-
this.
|
|
7020
|
-
|
|
6990
|
+
this.emit("ERROR", {
|
|
6991
|
+
err: error_createError({
|
|
6992
|
+
message: "WebSocket stream error",
|
|
6993
|
+
explanation: `The WebSocket stream emitted an error event. Details: ${util_pretty(err)}`,
|
|
6994
|
+
options: this.options,
|
|
6995
|
+
exc: streamError
|
|
6996
|
+
})
|
|
7021
6997
|
});
|
|
7022
|
-
}
|
|
6998
|
+
});
|
|
6999
|
+
this.stream.on("drain", ()=>{
|
|
7000
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *drain* event emitted (should not happen!)`);
|
|
7001
|
+
});
|
|
7002
|
+
this.stream.on("preend", (args)=>{
|
|
7003
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *preend* event emitted with args: ${util_pretty(args)}`);
|
|
7004
|
+
});
|
|
7005
|
+
this.stream.on("end", ()=>{
|
|
7006
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *end* event emitted`);
|
|
7007
|
+
});
|
|
7008
|
+
this.stream.on("drain", (args)=>{
|
|
7009
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *drain* event emitted with args: ${util_pretty(args)}`);
|
|
7010
|
+
});
|
|
7011
|
+
this.stream.on("pipe", (src)=>{
|
|
7012
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *pipe* event emitted with src: ${util_pretty(src)}`);
|
|
7013
|
+
});
|
|
7014
|
+
this.stream.on("unpipe", (src)=>{
|
|
7015
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *unpipe* event emitted with src: ${util_pretty(src)}`);
|
|
7016
|
+
});
|
|
7017
|
+
this.stream.on("resume", (args)=>{
|
|
7018
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *resume* event emitted with args: ${util_pretty(args)}`);
|
|
7019
|
+
});
|
|
7020
|
+
this.stream.on("uncork", (args)=>{
|
|
7021
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *uncork* event emitted with args: ${util_pretty(args)}`);
|
|
7022
|
+
});
|
|
7023
|
+
this.stream.on("readable", (args)=>{
|
|
7024
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *readable* event emitted with args: ${util_pretty(args)}`);
|
|
7025
|
+
});
|
|
7026
|
+
this.stream.on("prefinish", (args)=>{
|
|
7027
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *prefinish* event emitted with args: ${util_pretty(args)}`);
|
|
7028
|
+
});
|
|
7029
|
+
this.stream.on("finish", (args)=>{
|
|
7030
|
+
this.options.logger.debug(`${PIPE_SYMBOL}Stream *finish* event emitted with args: ${util_pretty(args)}`);
|
|
7031
|
+
});
|
|
7023
7032
|
}
|
|
7024
7033
|
}
|
|
7025
7034
|
showUserMedia() {
|
|
@@ -2,6 +2,7 @@ import { VideomailClientOptions } from "../../types/options.js";
|
|
|
2
2
|
import HTTPVideomailError from "./HTTPVideomailError.js";
|
|
3
3
|
import VideomailError from "./VideomailError.js";
|
|
4
4
|
interface ErrorParams {
|
|
5
|
+
cause?: unknown;
|
|
5
6
|
err?: HTTPVideomailError;
|
|
6
7
|
exc?: unknown;
|
|
7
8
|
message?: string;
|