@whereby.com/core 1.25.0 → 1.26.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/dist/index.cjs +266 -6
- package/dist/index.d.cts +40 -2
- package/dist/index.d.mts +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.mjs +267 -8
- package/dist/legacy-esm.js +267 -8
- package/dist/redux/index.cjs +264 -5
- package/dist/redux/index.d.cts +424 -3
- package/dist/redux/index.d.mts +424 -3
- package/dist/redux/index.d.ts +424 -3
- package/dist/redux/index.js +252 -7
- package/dist/redux/index.mjs +252 -7
- package/package.json +3 -3
package/dist/legacy-esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nodeBtoa from 'btoa';
|
|
2
|
-
import { assert, fromLocation, ServerSocket, isFileShareError, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, isRoomIntegrationErrorCode } from '@whereby.com/media';
|
|
2
|
+
import { assert, fromLocation, ServerSocket, isFileShareError, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, hasGetDisplayMedia, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues, isRoomIntegrationErrorCode } from '@whereby.com/media';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { createListenerMiddleware, addListener, createSlice, createAction, createSelector, createAsyncThunk, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
@@ -1308,7 +1308,7 @@ const createReactor = (selectors, callback) => {
|
|
|
1308
1308
|
});
|
|
1309
1309
|
};
|
|
1310
1310
|
|
|
1311
|
-
const coreVersion = "1.
|
|
1311
|
+
const coreVersion = "1.26.1";
|
|
1312
1312
|
|
|
1313
1313
|
function decodeRoomName(roomName) {
|
|
1314
1314
|
if (!roomName) {
|
|
@@ -2342,6 +2342,7 @@ const rtcEvents = {
|
|
|
2342
2342
|
rtcManagerDestroyed: createRtcEventAction("rtcManagerDestroyed"),
|
|
2343
2343
|
streamAdded: createRtcEventAction("streamAdded"),
|
|
2344
2344
|
clientConnectionStatusChanged: createRtcEventAction("clientConnectionStatusChanged"),
|
|
2345
|
+
mediaQualityChanged: createRtcEventAction("mediaQualityChanged"),
|
|
2345
2346
|
};
|
|
2346
2347
|
|
|
2347
2348
|
function createRemoteParticipant(client, newJoiner = false) {
|
|
@@ -2700,7 +2701,7 @@ const doKnockRoom = createAppThunk(() => (dispatch, getState) => {
|
|
|
2700
2701
|
socket === null || socket === void 0 ? void 0 : socket.emit("knock_room", Object.assign({ avatarUrl: null, config: {
|
|
2701
2702
|
isAudioEnabled: true,
|
|
2702
2703
|
isVideoEnabled: true,
|
|
2703
|
-
}, deviceCapabilities: { canScreenshare:
|
|
2704
|
+
}, deviceCapabilities: { canScreenshare: hasGetDisplayMedia() }, displayName, isCoLocated: false, isDialIn,
|
|
2704
2705
|
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
2705
2706
|
roomKey,
|
|
2706
2707
|
roomName,
|
|
@@ -2737,7 +2738,7 @@ const doConnectRoom = createAppThunk(() => (dispatch, getState) => {
|
|
|
2737
2738
|
socket === null || socket === void 0 ? void 0 : socket.emit("join_room", Object.assign({ avatarUrl: null, config: {
|
|
2738
2739
|
isAudioEnabled: isMicrophoneEnabled,
|
|
2739
2740
|
isVideoEnabled: isCameraEnabled,
|
|
2740
|
-
}, deviceCapabilities: { canScreenshare:
|
|
2741
|
+
}, deviceCapabilities: { canScreenshare: hasGetDisplayMedia() }, displayName, isCoLocated: false, isDialIn,
|
|
2741
2742
|
isAudioRecorder, isDevicePermissionDenied: false, kickFromOtherRooms: false, organizationId,
|
|
2742
2743
|
roomKey,
|
|
2743
2744
|
assistantKey,
|
|
@@ -3583,6 +3584,7 @@ const doEndMeeting = createAppAuthorizedThunk((state) => selectIsAuthorizedToEnd
|
|
|
3583
3584
|
dispatch(doAppStop());
|
|
3584
3585
|
}
|
|
3585
3586
|
});
|
|
3587
|
+
const selectRoomMode = (state) => state.room.mode;
|
|
3586
3588
|
const selectScreenshares = createSelector(selectLocalScreenshareStream, selectLocalParticipantRaw, selectRemoteParticipants, (localScreenshareStream, localParticipant, remoteParticipants) => {
|
|
3587
3589
|
const screenshares = [];
|
|
3588
3590
|
if (localScreenshareStream) {
|
|
@@ -3813,6 +3815,9 @@ const createWebRtcEmitter = (dispatch) => {
|
|
|
3813
3815
|
else if (eventName === "client_connection_status_changed") {
|
|
3814
3816
|
dispatch(rtcEvents.clientConnectionStatusChanged(data));
|
|
3815
3817
|
}
|
|
3818
|
+
else if (eventName === "media_quality_changed") {
|
|
3819
|
+
dispatch(rtcEvents.mediaQualityChanged(data));
|
|
3820
|
+
}
|
|
3816
3821
|
else ;
|
|
3817
3822
|
},
|
|
3818
3823
|
};
|
|
@@ -4187,8 +4192,66 @@ createReactor([selectStreamsToAccept, selectIsAcceptingStreams], ({ dispatch },
|
|
|
4187
4192
|
}
|
|
4188
4193
|
});
|
|
4189
4194
|
|
|
4195
|
+
const CALL_QUALITY_LEVELS = {
|
|
4196
|
+
CRITICAL: "critical",
|
|
4197
|
+
WARNING: "warning",
|
|
4198
|
+
OK: "ok",
|
|
4199
|
+
};
|
|
4200
|
+
const CALL_QUALITY_LEVEL_ORDER = Object.values(CALL_QUALITY_LEVELS);
|
|
4201
|
+
function convertQualityScoreToNumber(score) {
|
|
4202
|
+
return score !== undefined && score !== null
|
|
4203
|
+
? CALL_QUALITY_LEVEL_ORDER.indexOf(score)
|
|
4204
|
+
: CALL_QUALITY_LEVEL_ORDER.indexOf(CALL_QUALITY_LEVELS.OK);
|
|
4205
|
+
}
|
|
4206
|
+
const getActiveIssues = (allIssues, issuesToCheck = []) => Object.keys(allIssues).reduce((issuesAcc, issueKey) => {
|
|
4207
|
+
const issue = allIssues[issueKey];
|
|
4208
|
+
if (!issue)
|
|
4209
|
+
return issuesAcc;
|
|
4210
|
+
if (issuesToCheck.includes(issueKey) && issue.active && issue.registered > 2) {
|
|
4211
|
+
return [...issuesAcc, issueKey];
|
|
4212
|
+
}
|
|
4213
|
+
return issuesAcc;
|
|
4214
|
+
}, []);
|
|
4215
|
+
const addMetricsQualifier = (issuesToCheck, isLocalClient = false) => issuesToCheck.map((issue) => `${isLocalClient ? "loc" : "rem"}-${issue}`);
|
|
4216
|
+
function calculateCallQualityScore(clientId, roomMode, mediaQualityScores, connectionMonitorIssuesReport) {
|
|
4217
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
4218
|
+
const videoScoreValue = Math.min(...(roomMode === "normal"
|
|
4219
|
+
? [
|
|
4220
|
+
convertQualityScoreToNumber(((_c = (_b = (_a = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.critical) === null || _a === void 0 ? void 0 : _a[clientId]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.length) !== undefined &&
|
|
4221
|
+
((_f = (_e = (_d = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.critical) === null || _d === void 0 ? void 0 : _d[clientId]) === null || _e === void 0 ? void 0 : _e.video) === null || _f === void 0 ? void 0 : _f.length) > 0
|
|
4222
|
+
? CALL_QUALITY_LEVELS.CRITICAL
|
|
4223
|
+
: CALL_QUALITY_LEVELS.OK),
|
|
4224
|
+
convertQualityScoreToNumber(((_j = (_h = (_g = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.warning) === null || _g === void 0 ? void 0 : _g[clientId]) === null || _h === void 0 ? void 0 : _h.video) === null || _j === void 0 ? void 0 : _j.length) !== undefined &&
|
|
4225
|
+
((_m = (_l = (_k = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.warning) === null || _k === void 0 ? void 0 : _k[clientId]) === null || _l === void 0 ? void 0 : _l.video) === null || _m === void 0 ? void 0 : _m.length) > 0
|
|
4226
|
+
? CALL_QUALITY_LEVELS.WARNING
|
|
4227
|
+
: CALL_QUALITY_LEVELS.OK),
|
|
4228
|
+
]
|
|
4229
|
+
: [convertQualityScoreToNumber((_p = (_o = mediaQualityScores === null || mediaQualityScores === void 0 ? void 0 : mediaQualityScores[clientId]) === null || _o === void 0 ? void 0 : _o.video) !== null && _p !== void 0 ? _p : CALL_QUALITY_LEVELS.OK)]));
|
|
4230
|
+
const audioScoreValue = Math.min(...(roomMode === "normal"
|
|
4231
|
+
? [
|
|
4232
|
+
convertQualityScoreToNumber(((_s = (_r = (_q = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.critical) === null || _q === void 0 ? void 0 : _q[clientId]) === null || _r === void 0 ? void 0 : _r.audio) === null || _s === void 0 ? void 0 : _s.length) !== undefined &&
|
|
4233
|
+
((_v = (_u = (_t = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.critical) === null || _t === void 0 ? void 0 : _t[clientId]) === null || _u === void 0 ? void 0 : _u.audio) === null || _v === void 0 ? void 0 : _v.length) > 0
|
|
4234
|
+
? CALL_QUALITY_LEVELS.CRITICAL
|
|
4235
|
+
: CALL_QUALITY_LEVELS.OK),
|
|
4236
|
+
convertQualityScoreToNumber(((_y = (_x = (_w = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.warning) === null || _w === void 0 ? void 0 : _w[clientId]) === null || _x === void 0 ? void 0 : _x.audio) === null || _y === void 0 ? void 0 : _y.length) !== undefined &&
|
|
4237
|
+
((_1 = (_0 = (_z = connectionMonitorIssuesReport === null || connectionMonitorIssuesReport === void 0 ? void 0 : connectionMonitorIssuesReport.warning) === null || _z === void 0 ? void 0 : _z[clientId]) === null || _0 === void 0 ? void 0 : _0.audio) === null || _1 === void 0 ? void 0 : _1.length) > 0
|
|
4238
|
+
? CALL_QUALITY_LEVELS.WARNING
|
|
4239
|
+
: CALL_QUALITY_LEVELS.OK),
|
|
4240
|
+
]
|
|
4241
|
+
: [convertQualityScoreToNumber((_3 = (_2 = mediaQualityScores === null || mediaQualityScores === void 0 ? void 0 : mediaQualityScores[clientId]) === null || _2 === void 0 ? void 0 : _2.audio) !== null && _3 !== void 0 ? _3 : CALL_QUALITY_LEVELS.OK)]));
|
|
4242
|
+
const overallScoreValue = Math.min(videoScoreValue, audioScoreValue);
|
|
4243
|
+
return {
|
|
4244
|
+
total: CALL_QUALITY_LEVEL_ORDER[overallScoreValue],
|
|
4245
|
+
video: CALL_QUALITY_LEVEL_ORDER[videoScoreValue],
|
|
4246
|
+
audio: CALL_QUALITY_LEVEL_ORDER[audioScoreValue],
|
|
4247
|
+
};
|
|
4248
|
+
}
|
|
4190
4249
|
const connectionMonitorSliceInitialState = {
|
|
4191
4250
|
running: false,
|
|
4251
|
+
issuesReport: undefined,
|
|
4252
|
+
remoteQualityScores: undefined,
|
|
4253
|
+
localQualityScore: undefined,
|
|
4254
|
+
mediaScores: undefined,
|
|
4192
4255
|
};
|
|
4193
4256
|
const connectionMonitorSlice = createSlice({
|
|
4194
4257
|
name: "connectionMonitor",
|
|
@@ -4197,12 +4260,27 @@ const connectionMonitorSlice = createSlice({
|
|
|
4197
4260
|
connectionMonitorStarted: (state, action) => {
|
|
4198
4261
|
return Object.assign(Object.assign({}, state), { running: true, stopCallbackFunction: action.payload.stopIssueSubscription });
|
|
4199
4262
|
},
|
|
4263
|
+
connectionMonitorReportUpdated: (state, action) => {
|
|
4264
|
+
return Object.assign(Object.assign({}, state), { issuesReport: action.payload });
|
|
4265
|
+
},
|
|
4266
|
+
updateRemoteCallQualityScores: (state, action) => {
|
|
4267
|
+
return Object.assign(Object.assign({}, state), { remoteQualityScores: action.payload });
|
|
4268
|
+
},
|
|
4269
|
+
updateLocalCallQualityScore: (state, action) => {
|
|
4270
|
+
return Object.assign(Object.assign({}, state), { localQualityScore: action.payload });
|
|
4271
|
+
},
|
|
4200
4272
|
connectionMonitorStopped: () => {
|
|
4201
4273
|
return Object.assign({}, connectionMonitorSliceInitialState);
|
|
4202
4274
|
},
|
|
4203
4275
|
},
|
|
4276
|
+
extraReducers: (builder) => {
|
|
4277
|
+
builder.addCase(rtcEvents.mediaQualityChanged, (state, action) => {
|
|
4278
|
+
var _a;
|
|
4279
|
+
return Object.assign(Object.assign({}, state), { mediaScores: Object.assign(Object.assign({}, state.mediaScores), { [action.payload.clientId]: Object.assign(Object.assign({}, (((_a = state.mediaScores) === null || _a === void 0 ? void 0 : _a[action.payload.clientId]) || {})), { [action.payload.kind]: action.payload.quality }) }) });
|
|
4280
|
+
});
|
|
4281
|
+
},
|
|
4204
4282
|
});
|
|
4205
|
-
const { connectionMonitorStarted, connectionMonitorStopped } = connectionMonitorSlice.actions;
|
|
4283
|
+
const { connectionMonitorStarted, connectionMonitorStopped, connectionMonitorReportUpdated, updateRemoteCallQualityScores, updateLocalCallQualityScore, } = connectionMonitorSlice.actions;
|
|
4206
4284
|
const doStartConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
|
|
4207
4285
|
setClientProvider(() => {
|
|
4208
4286
|
const state = getState();
|
|
@@ -4227,8 +4305,52 @@ const doStartConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
|
|
|
4227
4305
|
return clientViews;
|
|
4228
4306
|
});
|
|
4229
4307
|
const issueMonitorSubscription = subscribeIssues({
|
|
4230
|
-
onUpdatedIssues: (issuesAndMetricsByClients) => {
|
|
4308
|
+
onUpdatedIssues: (issuesAndMetricsByClients, _, clients) => {
|
|
4231
4309
|
var _a;
|
|
4310
|
+
const clientsWithCriticalIssues = clients.reduce((acc, { clientId, isLocalClient }) => {
|
|
4311
|
+
const { issues } = issuesAndMetricsByClients[clientId] || { issues: {} };
|
|
4312
|
+
const criticalVideoIssues = getActiveIssues(issues, addMetricsQualifier(["cam-video-extreme-packetloss", "pres-video-extreme-packetloss"], isLocalClient));
|
|
4313
|
+
const criticalAudioIssues = getActiveIssues(issues, addMetricsQualifier(["cam-audio-extreme-packetloss"], isLocalClient));
|
|
4314
|
+
const criticalCpuIssues = getActiveIssues(issues, ["global-cpu-pressure-critical"]);
|
|
4315
|
+
if (criticalVideoIssues.length === 0 &&
|
|
4316
|
+
criticalAudioIssues.length === 0 &&
|
|
4317
|
+
criticalCpuIssues.length === 0) {
|
|
4318
|
+
return acc;
|
|
4319
|
+
}
|
|
4320
|
+
return Object.assign(Object.assign({}, acc), { [clientId]: {
|
|
4321
|
+
video: criticalVideoIssues,
|
|
4322
|
+
audio: criticalAudioIssues,
|
|
4323
|
+
cpu: criticalCpuIssues,
|
|
4324
|
+
} });
|
|
4325
|
+
}, {});
|
|
4326
|
+
const clientsWithWarningIssues = clients.reduce((acc, { clientId, isLocalClient }) => {
|
|
4327
|
+
const { issues } = issuesAndMetricsByClients[clientId] || { issues: {} };
|
|
4328
|
+
const warningVideoIssues = getActiveIssues(issues, addMetricsQualifier([
|
|
4329
|
+
"cam-video-bad-network",
|
|
4330
|
+
"pres-video-bad-network",
|
|
4331
|
+
"cam-video-high-packetloss",
|
|
4332
|
+
"pres-video-high-packetloss",
|
|
4333
|
+
"cam-video-low-layer0-bitrate",
|
|
4334
|
+
"pres-video-low-layer0-bitrate",
|
|
4335
|
+
], isLocalClient));
|
|
4336
|
+
const warningAudioIssues = getActiveIssues(issues, addMetricsQualifier(["cam-audio-bad-network", "cam-audio-high-packetloss", "cam-audio-distorted"], isLocalClient));
|
|
4337
|
+
const warningCpuIssues = getActiveIssues(issues, ["global-cpu-pressure-serious"]);
|
|
4338
|
+
if (warningVideoIssues.length === 0 &&
|
|
4339
|
+
warningAudioIssues.length === 0 &&
|
|
4340
|
+
warningCpuIssues.length === 0) {
|
|
4341
|
+
return acc;
|
|
4342
|
+
}
|
|
4343
|
+
return Object.assign(Object.assign({}, acc), { [clientId]: {
|
|
4344
|
+
video: warningVideoIssues,
|
|
4345
|
+
audio: warningAudioIssues,
|
|
4346
|
+
cpu: warningCpuIssues,
|
|
4347
|
+
} });
|
|
4348
|
+
}, {});
|
|
4349
|
+
const newConnectionMonitorReport = {
|
|
4350
|
+
critical: clientsWithCriticalIssues,
|
|
4351
|
+
warning: clientsWithWarningIssues,
|
|
4352
|
+
};
|
|
4353
|
+
dispatch(doUpdateConnectionMonitorReport(newConnectionMonitorReport));
|
|
4232
4354
|
const state = getState();
|
|
4233
4355
|
const rtcManager = selectRtcManager(state);
|
|
4234
4356
|
if (!rtcManager) {
|
|
@@ -4260,6 +4382,85 @@ const doStartConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
|
|
|
4260
4382
|
});
|
|
4261
4383
|
dispatch(connectionMonitorStarted({ stopIssueSubscription: issueMonitorSubscription.stop }));
|
|
4262
4384
|
});
|
|
4385
|
+
const doUpdateConnectionMonitorReport = createAppThunk((newConnectionMonitorReport) => (dispatch, getState) => {
|
|
4386
|
+
const state = getState();
|
|
4387
|
+
const rtcManager = selectRtcManager(state);
|
|
4388
|
+
if (!rtcManager) {
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
const oldConnectionMonitorReport = selectConnectionMonitorIssuesReport(state);
|
|
4392
|
+
if (JSON.stringify(newConnectionMonitorReport) === JSON.stringify(oldConnectionMonitorReport)) {
|
|
4393
|
+
return;
|
|
4394
|
+
}
|
|
4395
|
+
dispatch(connectionMonitorReportUpdated(newConnectionMonitorReport));
|
|
4396
|
+
const localClientId = selectSelfId(state);
|
|
4397
|
+
const updatedClientStates = {};
|
|
4398
|
+
["critical", "warning"].forEach((level) => {
|
|
4399
|
+
Object.keys(newConnectionMonitorReport[level] || {})
|
|
4400
|
+
.filter((clientId) => {
|
|
4401
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4402
|
+
const isLocalClientId = clientId === localClientId;
|
|
4403
|
+
return (((_c = (_b = (_a = newConnectionMonitorReport === null || newConnectionMonitorReport === void 0 ? void 0 : newConnectionMonitorReport[level]) === null || _a === void 0 ? void 0 : _a[clientId]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.includes(addMetricsQualifier(["cam-video-bad-network"], isLocalClientId)[0])) ||
|
|
4404
|
+
((_f = (_e = (_d = newConnectionMonitorReport === null || newConnectionMonitorReport === void 0 ? void 0 : newConnectionMonitorReport[level]) === null || _d === void 0 ? void 0 : _d[clientId]) === null || _e === void 0 ? void 0 : _e.audio) === null || _f === void 0 ? void 0 : _f.includes(addMetricsQualifier(["cam-audio-bad-network"], isLocalClientId)[0])));
|
|
4405
|
+
})
|
|
4406
|
+
.forEach((newClientId) => {
|
|
4407
|
+
const oldClient = Object.keys((oldConnectionMonitorReport === null || oldConnectionMonitorReport === void 0 ? void 0 : oldConnectionMonitorReport[level]) || {}).find((oldClientId) => oldClientId === newClientId);
|
|
4408
|
+
if (!oldClient)
|
|
4409
|
+
updatedClientStates[newClientId] = { badNetwork: true };
|
|
4410
|
+
});
|
|
4411
|
+
Object.keys((oldConnectionMonitorReport === null || oldConnectionMonitorReport === void 0 ? void 0 : oldConnectionMonitorReport[level]) || {})
|
|
4412
|
+
.filter((clientId) => {
|
|
4413
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4414
|
+
const isLocalClientId = clientId === localClientId;
|
|
4415
|
+
return (((_c = (_b = (_a = oldConnectionMonitorReport === null || oldConnectionMonitorReport === void 0 ? void 0 : oldConnectionMonitorReport[level]) === null || _a === void 0 ? void 0 : _a[clientId]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.includes(addMetricsQualifier(["cam-video-bad-network"], isLocalClientId)[0])) ||
|
|
4416
|
+
((_f = (_e = (_d = oldConnectionMonitorReport === null || oldConnectionMonitorReport === void 0 ? void 0 : oldConnectionMonitorReport[level]) === null || _d === void 0 ? void 0 : _d[clientId]) === null || _e === void 0 ? void 0 : _e.audio) === null || _f === void 0 ? void 0 : _f.includes(addMetricsQualifier(["cam-audio-bad-network"], isLocalClientId)[0])));
|
|
4417
|
+
})
|
|
4418
|
+
.forEach((oldClientId) => {
|
|
4419
|
+
const newClient = Object.keys(newConnectionMonitorReport[level]).find((newClientId) => newClientId === oldClientId);
|
|
4420
|
+
if (!newClient)
|
|
4421
|
+
updatedClientStates[oldClientId] = { badNetwork: false };
|
|
4422
|
+
});
|
|
4423
|
+
});
|
|
4424
|
+
if (Object.keys(updatedClientStates).length > 0) {
|
|
4425
|
+
rtcManager.sendStatsCustomEvent("clientStates", {
|
|
4426
|
+
updatesByClientId: updatedClientStates,
|
|
4427
|
+
_time: Date.now(),
|
|
4428
|
+
});
|
|
4429
|
+
}
|
|
4430
|
+
});
|
|
4431
|
+
const doSetRemoteCallQualityScores = createAppThunk((scores) => (dispatch, getState) => {
|
|
4432
|
+
const state = getState();
|
|
4433
|
+
const rtcManager = selectRtcManager(state);
|
|
4434
|
+
if (!rtcManager) {
|
|
4435
|
+
return;
|
|
4436
|
+
}
|
|
4437
|
+
const scoreValues = Object.values(scores);
|
|
4438
|
+
const total = scoreValues.some(({ total }) => total === CALL_QUALITY_LEVELS.CRITICAL)
|
|
4439
|
+
? CALL_QUALITY_LEVELS.CRITICAL
|
|
4440
|
+
: scoreValues.some(({ total }) => total === CALL_QUALITY_LEVELS.WARNING)
|
|
4441
|
+
? CALL_QUALITY_LEVELS.WARNING
|
|
4442
|
+
: CALL_QUALITY_LEVELS.OK;
|
|
4443
|
+
rtcManager.sendStatsCustomEvent("remoteCallQualityScores", {
|
|
4444
|
+
total,
|
|
4445
|
+
_time: Date.now(),
|
|
4446
|
+
});
|
|
4447
|
+
dispatch(updateRemoteCallQualityScores(scores));
|
|
4448
|
+
});
|
|
4449
|
+
const doSetLocalCallQualityScore = createAppThunk((score) => (dispatch, getState) => {
|
|
4450
|
+
const state = getState();
|
|
4451
|
+
const rtcManager = selectRtcManager(state);
|
|
4452
|
+
if (!rtcManager) {
|
|
4453
|
+
return;
|
|
4454
|
+
}
|
|
4455
|
+
const oldLocalCallQualityScore = selectLocalCallQualityScore(state);
|
|
4456
|
+
if (score.total !== (oldLocalCallQualityScore === null || oldLocalCallQualityScore === void 0 ? void 0 : oldLocalCallQualityScore.total)) {
|
|
4457
|
+
rtcManager.sendStatsCustomEvent("callQualityScoreTotalChanged", {
|
|
4458
|
+
total: score.total,
|
|
4459
|
+
_time: Date.now(),
|
|
4460
|
+
});
|
|
4461
|
+
}
|
|
4462
|
+
dispatch(updateLocalCallQualityScore(score));
|
|
4463
|
+
});
|
|
4263
4464
|
const doStopConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
|
|
4264
4465
|
const state = getState();
|
|
4265
4466
|
const stopCallbackFn = selectStopCallbackFunction(state);
|
|
@@ -4270,6 +4471,16 @@ const doStopConnectionMonitor = createAppThunk(() => (dispatch, getState) => {
|
|
|
4270
4471
|
});
|
|
4271
4472
|
const selectConnectionMonitorIsRunning = (state) => state.connectionMonitor.running;
|
|
4272
4473
|
const selectStopCallbackFunction = (state) => state.connectionMonitor.stopCallbackFunction;
|
|
4474
|
+
const selectConnectionMonitorIssuesReport = (state) => state.connectionMonitor.issuesReport;
|
|
4475
|
+
const selectConnectionMediaQualityScores = (state) => state.connectionMonitor.mediaScores;
|
|
4476
|
+
const selectRemoteCallQualityScores = (state) => state.connectionMonitor.remoteQualityScores;
|
|
4477
|
+
const selectLocalCallQualityScore = (state) => state.connectionMonitor.localQualityScore;
|
|
4478
|
+
const selectRemoteParticipantQualityReport = createSelector(selectRemoteCallQualityScores, (remoteCallQualityScores) => {
|
|
4479
|
+
if (!remoteCallQualityScores) {
|
|
4480
|
+
return undefined;
|
|
4481
|
+
}
|
|
4482
|
+
return Object.fromEntries(Object.entries(remoteCallQualityScores).map(([clientId, { total }]) => [clientId, { quality: total }]));
|
|
4483
|
+
});
|
|
4273
4484
|
const selectShouldStartConnectionMonitor = createSelector(selectRoomConnectionStatus, selectConnectionMonitorIsRunning, (roomConnectionStatus, isRunning) => {
|
|
4274
4485
|
if (!isRunning && roomConnectionStatus === "connected") {
|
|
4275
4486
|
return true;
|
|
@@ -4282,6 +4493,23 @@ const selectShouldStopConnectionMonitor = createSelector(selectRoomConnectionSta
|
|
|
4282
4493
|
}
|
|
4283
4494
|
return false;
|
|
4284
4495
|
});
|
|
4496
|
+
const selectCalculatedRemoteCallQualityScores = createSelector(selectRoomConnectionStatus, selectRoomMode, selectRemoteClientViews, selectConnectionMediaQualityScores, selectConnectionMonitorIssuesReport, (roomConnectionStatus, roomMode, remoteClientViews, mediaQualityScores, connectionMonitorIssuesReport) => {
|
|
4497
|
+
if (roomConnectionStatus !== "connected") {
|
|
4498
|
+
return undefined;
|
|
4499
|
+
}
|
|
4500
|
+
return Object.fromEntries(remoteClientViews
|
|
4501
|
+
.filter(({ isLocalClient }) => !isLocalClient)
|
|
4502
|
+
.map(({ clientId }) => [
|
|
4503
|
+
clientId,
|
|
4504
|
+
calculateCallQualityScore(clientId, roomMode, mediaQualityScores, connectionMonitorIssuesReport),
|
|
4505
|
+
]));
|
|
4506
|
+
});
|
|
4507
|
+
const selectCalculatedLocalCallQualityScore = createSelector(selectRoomConnectionStatus, selectRoomMode, selectLocalParticipantView, selectConnectionMediaQualityScores, selectConnectionMonitorIssuesReport, (roomConnectionStatus, roomMode, localParticipantView, mediaQualityScores, connectionMonitorIssuesReport) => {
|
|
4508
|
+
if (roomConnectionStatus !== "connected" || !localParticipantView) {
|
|
4509
|
+
return undefined;
|
|
4510
|
+
}
|
|
4511
|
+
return calculateCallQualityScore(localParticipantView.clientId, roomMode, mediaQualityScores, connectionMonitorIssuesReport);
|
|
4512
|
+
});
|
|
4285
4513
|
createReactor([selectShouldStartConnectionMonitor], ({ dispatch }, shouldStartConnectionMonitor) => {
|
|
4286
4514
|
if (shouldStartConnectionMonitor) {
|
|
4287
4515
|
dispatch(doStartConnectionMonitor());
|
|
@@ -4292,6 +4520,24 @@ createReactor([selectShouldStopConnectionMonitor], ({ dispatch }, shouldStartCon
|
|
|
4292
4520
|
dispatch(doStopConnectionMonitor());
|
|
4293
4521
|
}
|
|
4294
4522
|
});
|
|
4523
|
+
createReactor([selectCalculatedRemoteCallQualityScores, selectRemoteCallQualityScores], ({ dispatch }, newRemoteCallQualityScores, oldRemoteCallQualityScores) => {
|
|
4524
|
+
if (!newRemoteCallQualityScores) {
|
|
4525
|
+
return;
|
|
4526
|
+
}
|
|
4527
|
+
if (oldRemoteCallQualityScores &&
|
|
4528
|
+
JSON.stringify(newRemoteCallQualityScores) === JSON.stringify(oldRemoteCallQualityScores))
|
|
4529
|
+
return;
|
|
4530
|
+
dispatch(doSetRemoteCallQualityScores(newRemoteCallQualityScores));
|
|
4531
|
+
});
|
|
4532
|
+
createReactor([selectCalculatedLocalCallQualityScore, selectLocalCallQualityScore], ({ dispatch }, newLocalCallQualityScore, oldLocalCallQualityScore) => {
|
|
4533
|
+
if (!newLocalCallQualityScore) {
|
|
4534
|
+
return;
|
|
4535
|
+
}
|
|
4536
|
+
if (oldLocalCallQualityScore &&
|
|
4537
|
+
JSON.stringify(newLocalCallQualityScore) === JSON.stringify(oldLocalCallQualityScore))
|
|
4538
|
+
return;
|
|
4539
|
+
dispatch(doSetLocalCallQualityScore(newLocalCallQualityScore));
|
|
4540
|
+
});
|
|
4295
4541
|
|
|
4296
4542
|
const MAX_FILES_PER_UPLOAD = 10;
|
|
4297
4543
|
const MAX_FILE_SIZE = 15 * 1024 * 1024;
|
|
@@ -6101,6 +6347,7 @@ const LIVE_CAPTIONS_STATUS_CHANGED = "live-captions:status-changed";
|
|
|
6101
6347
|
const LIVE_TRANSCRIPTION_STATUS_CHANGED = "live-transcription:status-changed";
|
|
6102
6348
|
const CONNECTION_ERROR_CHANGED = "connection:error-changed";
|
|
6103
6349
|
const AUDIO_ONLY_MODE_CHANGED = "audio-only-mode:changed";
|
|
6350
|
+
const REMOTE_PARTICIPANT_QUALITY_REPORT_CHANGED = "remote-participant-quality-report:changed";
|
|
6104
6351
|
const LOCAL_PARTICIPANT_CHANGED = "local-participant:changed";
|
|
6105
6352
|
const LOCAL_SCREENSHARE_STATUS_CHANGED = "local-screenshare:status-changed";
|
|
6106
6353
|
const LOCAL_SCREENSHARE_CHANGED = "local-screenshare:state-changed";
|
|
@@ -6119,7 +6366,8 @@ const ROOM_JOINED = "room:joined";
|
|
|
6119
6366
|
const ROOM_JOINED_ERROR = "room:joined:error";
|
|
6120
6367
|
const ROOM_REJOINED = "room:rejoined";
|
|
6121
6368
|
|
|
6122
|
-
const
|
|
6369
|
+
const EMPTY_REMOTE_PARTICIPANT_QUALITY_REPORT = Object.freeze({});
|
|
6370
|
+
const selectRoomConnectionState = createSelector(selectChatMessages, selectFileUploads, selectCloudRecordingRaw, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutActive, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutAssignments, selectBreakoutEnforceAssignment, selectBreakoutTimerSetting, selectBreakoutTimerDuration, selectBreakoutAutoMoveToGroup, selectBreakoutMoveToGroupGracePeriod, selectBreakoutAutoMoveToMain, selectBreakoutMoveToMainGracePeriod, selectBreakoutStartedAt, selectBreakoutEndTime, selectBreakoutMoveToGroupAt, selectBreakoutMoveToMainAt, selectBreakoutIsAvailable, selectBreakoutError, selectAllClientViewsInCurrentGroup, selectLiveCaptionsRaw, selectLiveTranscriptionRaw, selectLocalParticipantRaw, selectLocalMediaStream, selectLocalScreenshareRaw, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectRoomConnectionError, selectRoomConnectionKnockResponse, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, selectIsCameraEnabled, selectIsMicrophoneEnabled, selectRoomIntegrationsRaw, selectEnabledRoomIntegrations, selectEmbeddableRoomIntegrations, selectRunningRoomIntegrations, selectIsAudioOnlyModeEnabled, selectRemoteParticipantQualityReport, (chatMessages, fileUploads, cloudRecording, breakoutCurrentGroup, breakoutCurrentId, breakoutActive, breakoutGroupedParticipants, breakoutGroups, breakoutAssignments, breakoutEnforceAssignment, breakoutTimerSetting, breakoutTimerDuration, breakoutAutoMoveToGroup, breakoutMoveToGroupGracePeriod, breakoutAutoMoveToMain, breakoutMoveToMainGracePeriod, breakoutStartedAt, breakoutEndTime, breakoutMoveToGroupAt, breakoutMoveToMainAt, breakoutIsAvailable, breakoutError, clientViewsInCurrentGroup, liveCaptions, liveTranscription, localParticipant, localMediaStream, localScreenshare, remoteParticipants, screenshares, connectionStatus, connectionError, knockResponse, streaming, waitingParticipants, notificationsEmitter, spotlightedClientViews, isCameraEnabled, isMicrophoneEnabled, roomIntegrationsRaw, enabledRoomIntegrations, embeddableRoomIntegrations, runningRoomIntegrations, isAudioOnlyModeEnabled, remoteParticipantQualityReport) => {
|
|
6123
6371
|
const broadcastingParticipants = breakoutActive && breakoutCurrentId
|
|
6124
6372
|
? spotlightedClientViews.filter((c) => !c.breakoutGroup && c.isAudioEnabled && !c.isPresentation)
|
|
6125
6373
|
: [];
|
|
@@ -6154,6 +6402,7 @@ const selectRoomConnectionState = createSelector(selectChatMessages, selectFileU
|
|
|
6154
6402
|
participantsInCurrentGroup: clientViewsInCurrentGroup,
|
|
6155
6403
|
broadcastingParticipants,
|
|
6156
6404
|
},
|
|
6405
|
+
remoteParticipantQualityReport: remoteParticipantQualityReport !== null && remoteParticipantQualityReport !== void 0 ? remoteParticipantQualityReport : EMPTY_REMOTE_PARTICIPANT_QUALITY_REPORT,
|
|
6157
6406
|
connectionStatus,
|
|
6158
6407
|
connectionError,
|
|
6159
6408
|
knockResponse,
|
|
@@ -6224,6 +6473,7 @@ class RoomConnectionClient extends BaseClient {
|
|
|
6224
6473
|
this.cloudRecordingSubscribers = new Set();
|
|
6225
6474
|
this.connectionErrorSubscribers = new Set();
|
|
6226
6475
|
this.audioOnlyModeSubscribers = new Set();
|
|
6476
|
+
this.remoteParticipantQualityReportSubscribers = new Set();
|
|
6227
6477
|
this.connectionStatusSubscribers = new Set();
|
|
6228
6478
|
this.liveStreamSubscribers = new Set();
|
|
6229
6479
|
this.liveCaptionsSubscribers = new Set();
|
|
@@ -6275,6 +6525,10 @@ class RoomConnectionClient extends BaseClient {
|
|
|
6275
6525
|
this.audioOnlyModeSubscribers.forEach((cb) => cb(state.isAudioOnlyModeEnabled));
|
|
6276
6526
|
this.emit(AUDIO_ONLY_MODE_CHANGED, state.isAudioOnlyModeEnabled);
|
|
6277
6527
|
}
|
|
6528
|
+
if (state.remoteParticipantQualityReport !== previousState.remoteParticipantQualityReport) {
|
|
6529
|
+
this.remoteParticipantQualityReportSubscribers.forEach((cb) => cb(state.remoteParticipantQualityReport));
|
|
6530
|
+
this.emit(REMOTE_PARTICIPANT_QUALITY_REPORT_CHANGED, state.remoteParticipantQualityReport);
|
|
6531
|
+
}
|
|
6278
6532
|
if (state.isCameraEnabled !== previousState.isCameraEnabled) {
|
|
6279
6533
|
this.cameraStateSubscribers.forEach((cb) => cb(state.isCameraEnabled));
|
|
6280
6534
|
this.emit(CAMERA_STATE_CHANGED, state.isCameraEnabled);
|
|
@@ -6412,6 +6666,10 @@ class RoomConnectionClient extends BaseClient {
|
|
|
6412
6666
|
this.audioOnlyModeSubscribers.add(callback);
|
|
6413
6667
|
return () => this.audioOnlyModeSubscribers.delete(callback);
|
|
6414
6668
|
}
|
|
6669
|
+
subscribeToRemoteParticipantQualityReport(callback) {
|
|
6670
|
+
this.remoteParticipantQualityReportSubscribers.add(callback);
|
|
6671
|
+
return () => this.remoteParticipantQualityReportSubscribers.delete(callback);
|
|
6672
|
+
}
|
|
6415
6673
|
subscribeToLiveStream(callback) {
|
|
6416
6674
|
this.liveStreamSubscribers.add(callback);
|
|
6417
6675
|
return () => this.liveStreamSubscribers.delete(callback);
|
|
@@ -6734,6 +6992,7 @@ class RoomConnectionClient extends BaseClient {
|
|
|
6734
6992
|
this.cloudRecordingSubscribers.clear();
|
|
6735
6993
|
this.connectionErrorSubscribers.clear();
|
|
6736
6994
|
this.audioOnlyModeSubscribers.clear();
|
|
6995
|
+
this.remoteParticipantQualityReportSubscribers.clear();
|
|
6737
6996
|
this.connectionStatusSubscribers.clear();
|
|
6738
6997
|
this.liveStreamSubscribers.clear();
|
|
6739
6998
|
this.localParticipantSubscribers.clear();
|
|
@@ -6774,4 +7033,4 @@ class WherebyClient {
|
|
|
6774
7033
|
}
|
|
6775
7034
|
}
|
|
6776
7035
|
|
|
6777
|
-
export { ACCEPTED_FILE_TYPES, AUDIO_ONLY_MODE_CHANGED, ApiClient, BREAKOUT_CONFIG_CHANGED, BREAKOUT_GROUPS_MIN_MAX, BREAKOUT_UNAVAILABLE_ERROR, CAMERA_DEVICES_CHANGED, CAMERA_DEVICE_ERROR_CHANGED, CAMERA_ENABLED_CHANGED, CAMERA_STATE_CHANGED, CHAT_NEW_MESSAGE, CLIENT_VIEW_CHANGED, CLIENT_VIEW_SPOTLIGHTS_CHANGED, CLOUD_RECORDING_STATUS_CHANGED, CONNECTION_ERROR_CHANGED, CONNECTION_STATUS_CHANGED, CURRENT_CAMERA_CHANGED, CURRENT_MICROPHONE_CHANGED, CURRENT_SPEAKER_CHANGED, Credentials, CredentialsService, DEFAULT_BREAKOUT_TIMER_DURATION, GridClient, IS_SETTING_CAMERA_DEVICE, IS_SETTING_MICROPHONE_DEVICE, LIVE_CAPTIONS_STATUS_CHANGED, LIVE_TRANSCRIPTION_STATUS_CHANGED, LOCAL_MEDIA_STARTING, LOCAL_MEDIA_START_ERROR_CHANGED, LOCAL_PARTICIPANT_CHANGED, LOCAL_SCREENSHARE_CHANGED, LOCAL_SCREENSHARE_STATUS_CHANGED, LOCAL_STREAM_CHANGED, LiveCaption, LocalMediaClient, LocalParticipant, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, MICROPHONE_DEVICES_CHANGED, MICROPHONE_DEVICE_ERROR_CHANGED, MICROPHONE_ENABLED_CHANGED, MICROPHONE_STATE_CHANGED, NUMBER_OF_CLIENT_VIEWS_CHANGED, Organization, OrganizationApiClient, OrganizationService, OrganizationServiceCache, REMOTE_PARTICIPANTS_CHANGED, ROOM_INTEGRATION_PICKER_MESSAGES, ROOM_JOINED, ROOM_JOINED_ERROR, ROOM_REJOINED, RUNNING_ROOM_INTEGRATIONS_CHANGED, RoomConnectionClient, RoomIntegrationService, RoomService, SCREENSHARE_STARTED, SCREENSHARE_STOPPED, SPEAKER_DEVICES_CHANGED, SPOTLIGHT_PARTICIPANT_ADDED, SPOTLIGHT_PARTICIPANT_REMOVED, STREAMING_STARTED, STREAMING_STOPPED, WAITING_PARTICIPANT_JOINED, WAITING_PARTICIPANT_LEFT, WherebyClient, createBreakoutGroups, createServices, debounce, defaultBreakoutGroupName, getAudioTrack, getFakeMediaStream, getUsableCameraEffectPresets, getVideoTrack, hasValue, isAudioDenoiserSupported, miro, parseUnverifiedRoomKeyData, roomIntegrationContent, roomIntegrationContentTagName, roomIntegrationPickerUrl, youtube };
|
|
7036
|
+
export { ACCEPTED_FILE_TYPES, AUDIO_ONLY_MODE_CHANGED, ApiClient, BREAKOUT_CONFIG_CHANGED, BREAKOUT_GROUPS_MIN_MAX, BREAKOUT_UNAVAILABLE_ERROR, CAMERA_DEVICES_CHANGED, CAMERA_DEVICE_ERROR_CHANGED, CAMERA_ENABLED_CHANGED, CAMERA_STATE_CHANGED, CHAT_NEW_MESSAGE, CLIENT_VIEW_CHANGED, CLIENT_VIEW_SPOTLIGHTS_CHANGED, CLOUD_RECORDING_STATUS_CHANGED, CONNECTION_ERROR_CHANGED, CONNECTION_STATUS_CHANGED, CURRENT_CAMERA_CHANGED, CURRENT_MICROPHONE_CHANGED, CURRENT_SPEAKER_CHANGED, Credentials, CredentialsService, DEFAULT_BREAKOUT_TIMER_DURATION, GridClient, IS_SETTING_CAMERA_DEVICE, IS_SETTING_MICROPHONE_DEVICE, LIVE_CAPTIONS_STATUS_CHANGED, LIVE_TRANSCRIPTION_STATUS_CHANGED, LOCAL_MEDIA_STARTING, LOCAL_MEDIA_START_ERROR_CHANGED, LOCAL_PARTICIPANT_CHANGED, LOCAL_SCREENSHARE_CHANGED, LOCAL_SCREENSHARE_STATUS_CHANGED, LOCAL_STREAM_CHANGED, LiveCaption, LocalMediaClient, LocalParticipant, MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, MICROPHONE_DEVICES_CHANGED, MICROPHONE_DEVICE_ERROR_CHANGED, MICROPHONE_ENABLED_CHANGED, MICROPHONE_STATE_CHANGED, NUMBER_OF_CLIENT_VIEWS_CHANGED, Organization, OrganizationApiClient, OrganizationService, OrganizationServiceCache, REMOTE_PARTICIPANTS_CHANGED, REMOTE_PARTICIPANT_QUALITY_REPORT_CHANGED, ROOM_INTEGRATION_PICKER_MESSAGES, ROOM_JOINED, ROOM_JOINED_ERROR, ROOM_REJOINED, RUNNING_ROOM_INTEGRATIONS_CHANGED, RoomConnectionClient, RoomIntegrationService, RoomService, SCREENSHARE_STARTED, SCREENSHARE_STOPPED, SPEAKER_DEVICES_CHANGED, SPOTLIGHT_PARTICIPANT_ADDED, SPOTLIGHT_PARTICIPANT_REMOVED, STREAMING_STARTED, STREAMING_STOPPED, WAITING_PARTICIPANT_JOINED, WAITING_PARTICIPANT_LEFT, WherebyClient, createBreakoutGroups, createServices, debounce, defaultBreakoutGroupName, getAudioTrack, getFakeMediaStream, getUsableCameraEffectPresets, getVideoTrack, hasValue, isAudioDenoiserSupported, miro, parseUnverifiedRoomKeyData, roomIntegrationContent, roomIntegrationContentTagName, roomIntegrationPickerUrl, youtube };
|