@stream-io/video-client 0.0.1-alpha.90 → 0.0.1-alpha.92
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/index.browser.es.js +20 -14
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +20 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -14
- package/dist/index.es.js.map +1 -1
- package/dist/src/coordinator/connection/types.d.ts +6 -6
- package/dist/src/rtc/Call.d.ts +7 -3
- package/package.json +1 -1
- package/src/coordinator/connection/connection.ts +8 -4
- package/src/coordinator/connection/types.ts +7 -26
- package/src/rtc/Call.ts +23 -4
package/dist/index.browser.es.js
CHANGED
|
@@ -6176,15 +6176,7 @@ class Call {
|
|
|
6176
6176
|
* @private
|
|
6177
6177
|
*/
|
|
6178
6178
|
this.leaveCallHooks = [];
|
|
6179
|
-
|
|
6180
|
-
* Remove subscription for WebSocket events that were created by the `on` method.
|
|
6181
|
-
* @param eventName
|
|
6182
|
-
* @param fn
|
|
6183
|
-
* @returns
|
|
6184
|
-
*/
|
|
6185
|
-
this.off = (eventName, fn) => {
|
|
6186
|
-
return this.dispatcher.off(eventName, fn);
|
|
6187
|
-
};
|
|
6179
|
+
this.streamClientEventHandlers = new Map();
|
|
6188
6180
|
/**
|
|
6189
6181
|
* Leave the call and stop the media streams that were published by the call.
|
|
6190
6182
|
*/
|
|
@@ -7014,9 +7006,21 @@ class Call {
|
|
|
7014
7006
|
fn(event);
|
|
7015
7007
|
}
|
|
7016
7008
|
};
|
|
7009
|
+
this.streamClientEventHandlers.set(fn, eventHandler);
|
|
7017
7010
|
return this.streamClient.on(eventName, eventHandler);
|
|
7018
7011
|
}
|
|
7019
7012
|
}
|
|
7013
|
+
off(eventName, fn) {
|
|
7014
|
+
if (isSfuEvent(eventName)) {
|
|
7015
|
+
return this.dispatcher.off(eventName, fn);
|
|
7016
|
+
}
|
|
7017
|
+
else {
|
|
7018
|
+
const registeredEventHandler = this.streamClientEventHandlers.get(fn);
|
|
7019
|
+
if (registeredEventHandler) {
|
|
7020
|
+
return this.streamClient.off(eventName, registeredEventHandler);
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
}
|
|
7020
7024
|
get data() {
|
|
7021
7025
|
return this.state.metadata;
|
|
7022
7026
|
}
|
|
@@ -7486,10 +7490,10 @@ class StableWSConnection {
|
|
|
7486
7490
|
return;
|
|
7487
7491
|
this._log('onmessage() - onmessage callback', { event, wsID });
|
|
7488
7492
|
const data = typeof event.data === 'string' ? JSON.parse(event.data) : null;
|
|
7489
|
-
// we wait till the first message before we consider the connection open
|
|
7493
|
+
// we wait till the first message before we consider the connection open.
|
|
7490
7494
|
// the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
|
|
7491
|
-
// after that a ws.onclose
|
|
7492
|
-
if (!this.isResolved && data) {
|
|
7495
|
+
// after that a ws.onclose.
|
|
7496
|
+
if (!this.isResolved && data && data.type === 'connection.ok') {
|
|
7493
7497
|
this.isResolved = true;
|
|
7494
7498
|
if (data.error) {
|
|
7495
7499
|
(_a = this.rejectPromise) === null || _a === void 0 ? void 0 : _a.call(this, this._errorFromWSEvent(data, false));
|
|
@@ -7500,7 +7504,9 @@ class StableWSConnection {
|
|
|
7500
7504
|
}
|
|
7501
7505
|
// trigger the event..
|
|
7502
7506
|
this.lastEvent = new Date();
|
|
7503
|
-
if (data &&
|
|
7507
|
+
if (data &&
|
|
7508
|
+
(data.type === 'health.check' || data.type === 'connection.ok')) {
|
|
7509
|
+
// the initial health-check should come from the client
|
|
7504
7510
|
this.scheduleNextPing();
|
|
7505
7511
|
}
|
|
7506
7512
|
this.client.handleEvent(event);
|
|
@@ -8941,7 +8947,7 @@ class StreamClient {
|
|
|
8941
8947
|
}
|
|
8942
8948
|
getUserAgent() {
|
|
8943
8949
|
return (this.userAgent ||
|
|
8944
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.
|
|
8950
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.91"}`);
|
|
8945
8951
|
}
|
|
8946
8952
|
setUserAgent(userAgent) {
|
|
8947
8953
|
this.userAgent = userAgent;
|