@stream-io/video-client 1.6.0 → 1.6.1
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/CHANGELOG.md +7 -0
- package/dist/index.browser.es.js +40 -22
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +40 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +40 -22
- package/dist/index.es.js.map +1 -1
- package/dist/src/events/call.d.ts +5 -1
- package/dist/src/events/internal.d.ts +0 -4
- package/dist/src/store/CallState.d.ts +5 -0
- package/package.json +1 -1
- package/src/events/__tests__/call.test.ts +48 -1
- package/src/events/call.ts +29 -2
- package/src/events/internal.ts +3 -17
- package/src/store/CallState.ts +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.6.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.0...@stream-io/video-client-1.6.1) (2024-09-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update state.endedAt after the SFU terminates the call ([#1477](https://github.com/GetStream/stream-video-js/issues/1477)) ([135b11f](https://github.com/GetStream/stream-video-js/commit/135b11f2e29f486f2f43b9ac2a84848d0fd0b5b4))
|
|
11
|
+
|
|
5
12
|
## [1.6.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.5.2...@stream-io/video-client-1.6.0) (2024-09-03)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -6735,7 +6735,7 @@ const logLevels = Object.freeze({
|
|
|
6735
6735
|
warn: 3,
|
|
6736
6736
|
error: 4,
|
|
6737
6737
|
});
|
|
6738
|
-
let logger$
|
|
6738
|
+
let logger$1;
|
|
6739
6739
|
let level = 'info';
|
|
6740
6740
|
const logToConsole = (logLevel, message, ...args) => {
|
|
6741
6741
|
let logMethod;
|
|
@@ -6769,7 +6769,7 @@ const logToConsole = (logLevel, message, ...args) => {
|
|
|
6769
6769
|
logMethod(message, ...args);
|
|
6770
6770
|
};
|
|
6771
6771
|
const setLogger = (l, lvl) => {
|
|
6772
|
-
logger$
|
|
6772
|
+
logger$1 = l;
|
|
6773
6773
|
if (lvl) {
|
|
6774
6774
|
setLogLevel(lvl);
|
|
6775
6775
|
}
|
|
@@ -6779,7 +6779,7 @@ const setLogLevel = (l) => {
|
|
|
6779
6779
|
};
|
|
6780
6780
|
const getLogLevel = () => level;
|
|
6781
6781
|
const getLogger = (withTags) => {
|
|
6782
|
-
const loggerMethod = logger$
|
|
6782
|
+
const loggerMethod = logger$1 || logToConsole;
|
|
6783
6783
|
const tags = (withTags || []).filter(Boolean).join(':');
|
|
6784
6784
|
const result = (logLevel, message, ...args) => {
|
|
6785
6785
|
if (logLevels[logLevel] >= logLevels[level]) {
|
|
@@ -7882,6 +7882,13 @@ class CallState {
|
|
|
7882
7882
|
this.setOwnCapabilities = (capabilities) => {
|
|
7883
7883
|
return this.setCurrentValue(this.ownCapabilitiesSubject, capabilities);
|
|
7884
7884
|
};
|
|
7885
|
+
/**
|
|
7886
|
+
* Sets the time when this call has been ended.
|
|
7887
|
+
* @param endedAt the time when this call has been ended.
|
|
7888
|
+
*/
|
|
7889
|
+
this.setEndedAt = (endedAt) => {
|
|
7890
|
+
return this.setCurrentValue(this.endedAtSubject, endedAt);
|
|
7891
|
+
};
|
|
7885
7892
|
/**
|
|
7886
7893
|
* Will try to find the participant with the given sessionId in the current call.
|
|
7887
7894
|
*
|
|
@@ -8068,7 +8075,7 @@ class CallState {
|
|
|
8068
8075
|
this.setCurrentValue(this.createdAtSubject, new Date(call.created_at));
|
|
8069
8076
|
this.setCurrentValue(this.updatedAtSubject, new Date(call.updated_at));
|
|
8070
8077
|
this.setCurrentValue(this.startsAtSubject, call.starts_at ? new Date(call.starts_at) : undefined);
|
|
8071
|
-
this.
|
|
8078
|
+
this.setEndedAt(call.ended_at ? new Date(call.ended_at) : undefined);
|
|
8072
8079
|
this.setCurrentValue(this.createdBySubject, call.created_by);
|
|
8073
8080
|
this.setCurrentValue(this.customSubject, call.custom);
|
|
8074
8081
|
this.setCurrentValue(this.egressSubject, call.egress);
|
|
@@ -8717,7 +8724,7 @@ const enableHighQualityAudio = (sdp, trackMid, maxBitrate = 510000) => {
|
|
|
8717
8724
|
return SDP.write(parsedSdp);
|
|
8718
8725
|
};
|
|
8719
8726
|
|
|
8720
|
-
const version = "1.6.
|
|
8727
|
+
const version = "1.6.1" ;
|
|
8721
8728
|
const [major, minor, patch] = version.split('.');
|
|
8722
8729
|
let sdkInfo = {
|
|
8723
8730
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -10007,15 +10014,37 @@ const watchCallRejected = (call) => {
|
|
|
10007
10014
|
* Event handler that watches the delivery of `call.ended` Websocket event.
|
|
10008
10015
|
*/
|
|
10009
10016
|
const watchCallEnded = (call) => {
|
|
10010
|
-
return
|
|
10017
|
+
return function onCallEnded() {
|
|
10011
10018
|
const { callingState } = call.state;
|
|
10012
10019
|
if (callingState === CallingState.RINGING ||
|
|
10013
10020
|
callingState === CallingState.JOINED ||
|
|
10014
10021
|
callingState === CallingState.JOINING) {
|
|
10015
|
-
|
|
10022
|
+
call.leave({ reason: 'call.ended event received' }).catch((err) => {
|
|
10023
|
+
call.logger('error', 'Failed to leave call after call.ended ', err);
|
|
10024
|
+
});
|
|
10016
10025
|
}
|
|
10017
10026
|
};
|
|
10018
10027
|
};
|
|
10028
|
+
/**
|
|
10029
|
+
* Watches for `callEnded` events.
|
|
10030
|
+
*/
|
|
10031
|
+
const watchSfuCallEnded = (call) => {
|
|
10032
|
+
return call.on('callEnded', async (e) => {
|
|
10033
|
+
if (call.state.callingState === CallingState.LEFT)
|
|
10034
|
+
return;
|
|
10035
|
+
try {
|
|
10036
|
+
// `call.ended` event arrived after the call is already left
|
|
10037
|
+
// and all event handlers are detached. We need to manually
|
|
10038
|
+
// update the call state to reflect the call has ended.
|
|
10039
|
+
call.state.setEndedAt(new Date());
|
|
10040
|
+
const reason = CallEndedReason[e.reason];
|
|
10041
|
+
await call.leave({ reason: `callEnded received: ${reason}` });
|
|
10042
|
+
}
|
|
10043
|
+
catch (err) {
|
|
10044
|
+
call.logger('error', 'Failed to leave call after being ended by the SFU', err);
|
|
10045
|
+
}
|
|
10046
|
+
});
|
|
10047
|
+
};
|
|
10019
10048
|
|
|
10020
10049
|
/**
|
|
10021
10050
|
* Event handler that watches for `callGrantsUpdated` events.
|
|
@@ -10043,7 +10072,6 @@ const watchCallGrantsUpdated = (state) => {
|
|
|
10043
10072
|
};
|
|
10044
10073
|
};
|
|
10045
10074
|
|
|
10046
|
-
const logger$1 = getLogger(['events']);
|
|
10047
10075
|
/**
|
|
10048
10076
|
* An event responder which handles the `changePublishQuality` event.
|
|
10049
10077
|
*/
|
|
@@ -10089,7 +10117,7 @@ const watchLiveEnded = (dispatcher, call) => {
|
|
|
10089
10117
|
return;
|
|
10090
10118
|
if (!call.permissionsContext.hasPermission(OwnCapability.JOIN_BACKSTAGE)) {
|
|
10091
10119
|
call.leave({ reason: 'live ended' }).catch((err) => {
|
|
10092
|
-
logger
|
|
10120
|
+
call.logger('error', 'Failed to leave call after live ended', err);
|
|
10093
10121
|
});
|
|
10094
10122
|
}
|
|
10095
10123
|
});
|
|
@@ -10101,8 +10129,9 @@ const watchSfuErrorReports = (dispatcher) => {
|
|
|
10101
10129
|
return dispatcher.on('error', (e) => {
|
|
10102
10130
|
if (!e.error)
|
|
10103
10131
|
return;
|
|
10132
|
+
const logger = getLogger(['SfuClient']);
|
|
10104
10133
|
const { error, reconnectStrategy } = e;
|
|
10105
|
-
logger
|
|
10134
|
+
logger('error', 'SFU reported error', {
|
|
10106
10135
|
code: ErrorCode[error.code],
|
|
10107
10136
|
reconnectStrategy: WebsocketReconnectStrategy[reconnectStrategy],
|
|
10108
10137
|
message: error.message,
|
|
@@ -10120,17 +10149,6 @@ const watchPinsUpdated = (state) => {
|
|
|
10120
10149
|
state.setServerSidePins(pins);
|
|
10121
10150
|
};
|
|
10122
10151
|
};
|
|
10123
|
-
/**
|
|
10124
|
-
* Watches for `callEnded` events.
|
|
10125
|
-
*/
|
|
10126
|
-
const watchSfuCallEnded = (call) => {
|
|
10127
|
-
return call.on('callEnded', (e) => {
|
|
10128
|
-
const reason = CallEndedReason[e.reason];
|
|
10129
|
-
call.leave({ reason }).catch((err) => {
|
|
10130
|
-
logger$1('error', 'Failed to leave call after call ended by the SFU', err);
|
|
10131
|
-
});
|
|
10132
|
-
});
|
|
10133
|
-
};
|
|
10134
10152
|
|
|
10135
10153
|
/**
|
|
10136
10154
|
* An event handler that handles soft mutes.
|
|
@@ -16050,7 +16068,7 @@ class StreamClient {
|
|
|
16050
16068
|
});
|
|
16051
16069
|
};
|
|
16052
16070
|
this.getUserAgent = () => {
|
|
16053
|
-
const version = "1.6.
|
|
16071
|
+
const version = "1.6.1" ;
|
|
16054
16072
|
return (this.userAgent ||
|
|
16055
16073
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
16056
16074
|
};
|