@webex/plugin-meetings 3.12.0 → 3.13.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.
- package/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +135 -0
- package/ai-docs/ARCHITECTURE.md +208 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/assets/README.md +28 -0
- package/assets/e2ee-0.0.1.js +2 -0
- package/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/aiEnableRequest/index.js +15 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/annotation/index.js +55 -19
- package/dist/annotation/index.js.map +1 -1
- package/dist/assets/e2ee-0.0.1.js +2 -0
- package/dist/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/events.js +29 -14
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +128 -7
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +54 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.js +39 -11
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/constants.js +11 -1
- package/dist/controls-options-manager/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +67 -29
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/util.js +91 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/hashTree/constants.js +13 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1245 -404
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +42 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +58 -16
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +24 -9
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +55 -12
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/interpretation.types.js +7 -0
- package/dist/interpretation/interpretation.types.js.map +1 -0
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +4 -1
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +914 -196
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +36 -5
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/types.js +20 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +229 -166
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +8 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +4 -5
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +5 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1931 -887
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +229 -82
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +10 -1
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +5 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +42 -3
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +12 -5
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +322 -129
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +6 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +39 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +116 -18
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +10 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +30 -0
- package/dist/member/util.js.map +1 -1
- package/dist/members/index.js +101 -43
- package/dist/members/index.js.map +1 -1
- package/dist/members/util.js +8 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +11 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/codec/constants.js +63 -0
- package/dist/multistream/codec/constants.js.map +1 -0
- package/dist/multistream/mediaRequestManager.js +62 -15
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +9 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +32 -4
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +127 -3
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +121 -83
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/recording-controller/index.js +1 -3
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -1
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +36 -2
- package/dist/types/config.d.ts +4 -2
- package/dist/types/constants.d.ts +15 -2
- package/dist/types/controls-options-manager/constants.d.ts +6 -1
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +2 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +230 -18
- package/dist/types/hashTree/utils.d.ts +18 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +151 -15
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +28 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
- package/dist/types/media/properties.d.ts +6 -2
- package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
- package/dist/types/meeting/index.d.ts +247 -13
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +1 -0
- package/dist/types/meeting/util.d.ts +12 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +40 -19
- package/dist/types/meetings/meetings.types.d.ts +15 -0
- package/dist/types/meetings/request.d.ts +14 -0
- package/dist/types/member/index.d.ts +1 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +9 -0
- package/dist/types/members/index.d.ts +15 -2
- package/dist/types/members/util.d.ts +1 -5
- package/dist/types/metrics/constants.d.ts +10 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- package/dist/types/multistream/sendSlotManager.d.ts +28 -2
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +3 -0
- package/dist/webinar/index.js +539 -245
- package/dist/webinar/index.js.map +1 -1
- package/package.json +26 -24
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/aiEnableRequest/index.ts +16 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +61 -29
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +145 -3
- package/src/common/errors/webex-errors.ts +56 -3
- package/src/config.ts +8 -3
- package/src/constants.ts +23 -4
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/controls-options-manager/constants.ts +14 -1
- package/src/controls-options-manager/index.ts +87 -28
- package/src/controls-options-manager/util.ts +81 -1
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/constants.ts +16 -0
- package/src/hashTree/hashTreeParser.ts +1021 -214
- package/src/hashTree/utils.ts +36 -0
- package/src/index.ts +7 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +59 -12
- package/src/interceptors/locusRetry.ts +26 -5
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +65 -10
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/controlsUtils.ts +3 -1
- package/src/locus-info/index.ts +907 -184
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/types.ts +33 -1
- package/src/media/MediaConnectionAwaiter.ts +229 -196
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +8 -3
- package/src/meeting/ai-docs/meeting-spec.md +404 -0
- package/src/meeting/in-meeting-actions.ts +8 -0
- package/src/meeting/index.ts +1237 -254
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +11 -0
- package/src/meeting/util.ts +53 -8
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +11 -4
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +224 -80
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +117 -4
- package/src/member/ai-docs/member-spec.md +196 -0
- package/src/member/index.ts +10 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +29 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/metrics/constants.ts +11 -0
- package/src/multistream/ai-docs/multistream-spec.md +295 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +119 -28
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +23 -1
- package/src/multistream/sendSlotManager.ts +112 -4
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reactions/reactions.type.ts +3 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +333 -73
- package/test/unit/spec/aiEnableRequest/index.ts +86 -0
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/events.ts +120 -2
- package/test/unit/spec/breakouts/index.ts +336 -15
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +3126 -238
- package/test/unit/spec/hashTree/utils.ts +125 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
- package/test/unit/spec/interceptors/locusRetry.ts +234 -5
- package/test/unit/spec/interpretation/index.ts +119 -4
- package/test/unit/spec/locus-info/controlsUtils.js +172 -57
- package/test/unit/spec/locus-info/index.js +1880 -136
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +26 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
- package/test/unit/spec/meeting/index.js +3697 -501
- package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
- package/test/unit/spec/meeting/muteState.js +81 -0
- package/test/unit/spec/meeting/request.js +12 -0
- package/test/unit/spec/meeting/utils.js +206 -16
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
- package/test/unit/spec/meetings/index.js +586 -53
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +402 -51
- package/test/unit/spec/member/index.js +7 -0
- package/test/unit/spec/member/util.js +89 -0
- package/test/unit/spec/members/index.js +216 -0
- package/test/unit/spec/members/request.js +37 -1
- package/test/unit/spec/members/utils.js +63 -0
- package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
- package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +165 -38
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/recording-controller/index.js +9 -8
- package/test/unit/spec/roap/turnDiscovery.ts +20 -0
- package/test/unit/spec/webinar/index.ts +982 -328
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import {SELF_ROLES, DISPLAY_HINTS, INTERSTITIAL_DISPLAY_HINTS} from '../constants';
|
|
2
2
|
|
|
3
|
+
// these values have to match what Locus sends us
|
|
4
|
+
export enum DisplayHintSection {
|
|
5
|
+
JOINED = 'joined',
|
|
6
|
+
MODERATOR = 'moderator',
|
|
7
|
+
COHOST = 'coHost',
|
|
8
|
+
PRESENTER = 'presenter',
|
|
9
|
+
PANELIST = 'panelist',
|
|
10
|
+
ATTENDEE = 'attendee',
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
const InfoUtils: any = {};
|
|
4
14
|
|
|
5
15
|
InfoUtils.parse = (info, roles, isJoined = true) => {
|
|
@@ -7,6 +17,9 @@ InfoUtils.parse = (info, roles, isJoined = true) => {
|
|
|
7
17
|
policy: InfoUtils.parsePolicy(info),
|
|
8
18
|
moderator: InfoUtils.parseModerator(info),
|
|
9
19
|
coHost: InfoUtils.parseCoHost(info),
|
|
20
|
+
presenter: InfoUtils.parsePresenter(info),
|
|
21
|
+
panelist: InfoUtils.parsePanelist(info),
|
|
22
|
+
attendee: InfoUtils.parseAttendee(info),
|
|
10
23
|
};
|
|
11
24
|
|
|
12
25
|
let userDisplayHints = isJoined
|
|
@@ -27,6 +40,18 @@ InfoUtils.parse = (info, roles, isJoined = true) => {
|
|
|
27
40
|
userDisplayHints = {...userDisplayHints, ...parsed.moderator};
|
|
28
41
|
}
|
|
29
42
|
|
|
43
|
+
if (roles.includes(SELF_ROLES.PRESENTER)) {
|
|
44
|
+
userDisplayHints = {...userDisplayHints, ...parsed.presenter};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (roles.includes(SELF_ROLES.PANELIST)) {
|
|
48
|
+
userDisplayHints = {...userDisplayHints, ...parsed.panelist};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (roles.includes(SELF_ROLES.ATTENDEE)) {
|
|
52
|
+
userDisplayHints = {...userDisplayHints, ...parsed.attendee};
|
|
53
|
+
}
|
|
54
|
+
|
|
30
55
|
parsed.userDisplayHints = Object.keys(userDisplayHints);
|
|
31
56
|
|
|
32
57
|
if (info.sipUri) {
|
|
@@ -44,8 +69,8 @@ InfoUtils.parse = (info, roles, isJoined = true) => {
|
|
|
44
69
|
return parsed;
|
|
45
70
|
};
|
|
46
71
|
|
|
47
|
-
InfoUtils.parseDisplayHintSection = (info, displayHintKey) => {
|
|
48
|
-
const displayHints = {};
|
|
72
|
+
InfoUtils.parseDisplayHintSection = (info: any, displayHintKey: DisplayHintSection) => {
|
|
73
|
+
const displayHints: Record<string, boolean> = {};
|
|
49
74
|
|
|
50
75
|
if (
|
|
51
76
|
info &&
|
|
@@ -53,7 +78,7 @@ InfoUtils.parseDisplayHintSection = (info, displayHintKey) => {
|
|
|
53
78
|
info.displayHints[displayHintKey] &&
|
|
54
79
|
info.displayHints[displayHintKey].length > 0
|
|
55
80
|
) {
|
|
56
|
-
info.displayHints[displayHintKey].forEach((key) => {
|
|
81
|
+
info.displayHints[displayHintKey].forEach((key: any) => {
|
|
57
82
|
displayHints[key] = true;
|
|
58
83
|
});
|
|
59
84
|
}
|
|
@@ -61,20 +86,30 @@ InfoUtils.parseDisplayHintSection = (info, displayHintKey) => {
|
|
|
61
86
|
return displayHints;
|
|
62
87
|
};
|
|
63
88
|
|
|
64
|
-
InfoUtils.parsePolicy = (info) =>
|
|
89
|
+
InfoUtils.parsePolicy = (info) =>
|
|
90
|
+
InfoUtils.parseDisplayHintSection(info, DisplayHintSection.JOINED);
|
|
65
91
|
|
|
66
92
|
InfoUtils.parseModerator = (info) => {
|
|
67
|
-
const displayHints = InfoUtils.parseDisplayHintSection(info,
|
|
93
|
+
const displayHints = InfoUtils.parseDisplayHintSection(info, DisplayHintSection.MODERATOR);
|
|
68
94
|
|
|
69
95
|
return {...displayHints, [DISPLAY_HINTS.LOWER_SOMEONE_ELSES_HAND]: true};
|
|
70
96
|
};
|
|
71
97
|
|
|
72
98
|
InfoUtils.parseCoHost = (info) => {
|
|
73
|
-
const displayHints = InfoUtils.parseDisplayHintSection(info,
|
|
99
|
+
const displayHints = InfoUtils.parseDisplayHintSection(info, DisplayHintSection.COHOST);
|
|
74
100
|
|
|
75
101
|
return {...displayHints, [DISPLAY_HINTS.LOWER_SOMEONE_ELSES_HAND]: true};
|
|
76
102
|
};
|
|
77
103
|
|
|
104
|
+
InfoUtils.parsePresenter = (info) =>
|
|
105
|
+
InfoUtils.parseDisplayHintSection(info, DisplayHintSection.PRESENTER);
|
|
106
|
+
|
|
107
|
+
InfoUtils.parsePanelist = (info) =>
|
|
108
|
+
InfoUtils.parseDisplayHintSection(info, DisplayHintSection.PANELIST);
|
|
109
|
+
|
|
110
|
+
InfoUtils.parseAttendee = (info) =>
|
|
111
|
+
InfoUtils.parseDisplayHintSection(info, DisplayHintSection.ATTENDEE);
|
|
112
|
+
|
|
78
113
|
InfoUtils.isLocked = (policy) => policy.LOCK_STATUS_LOCKED || false;
|
|
79
114
|
|
|
80
115
|
InfoUtils.isUnlocked = (policy) => policy.LOCK_STATUS_UNLOCKED || false;
|
package/src/locus-info/types.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
+
import {Enum} from '../constants';
|
|
1
2
|
import {HtMeta} from '../hashTree/types';
|
|
2
3
|
|
|
4
|
+
export const EndMeetingReason = {
|
|
5
|
+
maxMeetingDuration: 'MAX_MEETING_DURATION',
|
|
6
|
+
allParticipantsLeft: 'ALL_PARTICIPANTS_LEFT',
|
|
7
|
+
sipHostLeft: 'SIP_HOST_LEFT',
|
|
8
|
+
noHost: 'NO_HOST',
|
|
9
|
+
waitingForMpsEndMeetingTimeout: 'WAITING_FOR_MPS_END_MEETING_TIMEOUT',
|
|
10
|
+
fraudDetection: 'FRAUD_DETECTION',
|
|
11
|
+
meetingEndedByHost: 'MEETING_ENDED_BY_HOST',
|
|
12
|
+
meetingUpdated: 'MEETING_UPDATED', // Locus code has comment about EndMeetingIfPossible reason for this one
|
|
13
|
+
meetingCancelled: 'MEETING_CANCELLED', // Locus code has comment about EndMeetingIfPossible reason for this one
|
|
14
|
+
autoEndWithSingleParticipant: 'AUTO_END_WITH_SINGLE_PARTICIPANT',
|
|
15
|
+
breakoutEnded: 'BREAKOUT_ENDED', // indicates that only a breakout session ended, not the whole meeting
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type EndMeetingReason = Enum<typeof EndMeetingReason>;
|
|
19
|
+
|
|
3
20
|
export type LocusFullState = {
|
|
4
21
|
active: boolean;
|
|
5
22
|
count: number;
|
|
6
23
|
lastActive: string;
|
|
7
24
|
locked: boolean;
|
|
8
25
|
sessionId: string;
|
|
9
|
-
|
|
26
|
+
sessionIds: string[];
|
|
10
27
|
startTime: number;
|
|
11
28
|
state: string;
|
|
12
29
|
type: string;
|
|
30
|
+
endMeetingReason?: EndMeetingReason;
|
|
13
31
|
};
|
|
14
32
|
|
|
15
33
|
export type Links = {
|
|
@@ -32,6 +50,7 @@ export type LocusDTO = {
|
|
|
32
50
|
info?: any;
|
|
33
51
|
jsSdkMeta?: {
|
|
34
52
|
removedParticipantIds: string[]; // list of ids of participants that are removed in the last update
|
|
53
|
+
forceReplaceMembers?: boolean; // when true, forces a full replacement of meeting members (e.g. when switching to a new hash tree parser - when moving between breakouts)
|
|
35
54
|
};
|
|
36
55
|
links?: Links;
|
|
37
56
|
mediaShares?: any[];
|
|
@@ -52,3 +71,16 @@ export type LocusDTO = {
|
|
|
52
71
|
syncUrl?: string;
|
|
53
72
|
url?: string;
|
|
54
73
|
};
|
|
74
|
+
|
|
75
|
+
export type ReplacesInfo = {
|
|
76
|
+
locusUrl: string;
|
|
77
|
+
replacedAt: string;
|
|
78
|
+
sessionId: string;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const LocusErrorCodes = {
|
|
82
|
+
LOCUS_INACTIVE: 2403004,
|
|
83
|
+
LOCUS_USER_FULL: 2423001,
|
|
84
|
+
} as const;
|
|
85
|
+
|
|
86
|
+
export type LocusErrorCodes = Enum<typeof LocusErrorCodes>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Defer} from '@webex/common';
|
|
2
2
|
import {ConnectionState, MediaConnectionEventNames} from '@webex/internal-media-core';
|
|
3
3
|
import LoggerProxy from '../common/logs/logger-proxy';
|
|
4
|
-
import {
|
|
4
|
+
import {DTLS_CONNECTION_TIMEOUT, ICE_CONNECTION_TIMEOUT} from '../constants';
|
|
5
5
|
import BEHAVIORAL_METRICS from '../metrics/constants';
|
|
6
6
|
import Metrics from '../metrics';
|
|
7
7
|
|
|
@@ -10,282 +10,315 @@ export interface MediaConnectionAwaiterProps {
|
|
|
10
10
|
correlationId: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export interface FailureResult {
|
|
14
|
+
iceConnected: boolean;
|
|
15
|
+
iceConnectedAtLeastOnce: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type State =
|
|
19
|
+
| {name: 'idle'}
|
|
20
|
+
| {name: 'ice'; gatheringRetried: boolean}
|
|
21
|
+
| {name: 'dtls'}
|
|
22
|
+
| {name: 'connected'}
|
|
23
|
+
| {name: 'failed'; result: FailureResult};
|
|
24
|
+
|
|
25
|
+
type ActiveState = Extract<State, {name: 'ice' | 'dtls'}>;
|
|
26
|
+
type EnteredState = Exclude<State, {name: 'idle'}>;
|
|
27
|
+
|
|
28
|
+
const PHASE_TIMEOUT: Record<ActiveState['name'], number> = {
|
|
29
|
+
ice: ICE_CONNECTION_TIMEOUT,
|
|
30
|
+
dtls: DTLS_CONNECTION_TIMEOUT,
|
|
31
|
+
};
|
|
32
|
+
|
|
13
33
|
/**
|
|
14
|
-
*
|
|
34
|
+
* Waits for ICE and DTLS connectivity using explicit lifecycle states.
|
|
15
35
|
*/
|
|
16
36
|
export default class MediaConnectionAwaiter {
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private correlationId: string;
|
|
23
|
-
private onTimeoutCallback: () => void;
|
|
24
|
-
private peerConnectionStateCallback: () => void;
|
|
25
|
-
private iceConnectionStateCallback: () => void;
|
|
26
|
-
private iceGatheringStateCallback: () => void;
|
|
37
|
+
private props: MediaConnectionAwaiterProps;
|
|
38
|
+
private state: State = {name: 'idle'};
|
|
39
|
+
private timer?: ReturnType<typeof setTimeout>;
|
|
40
|
+
private iceConnectedAtLeastOnce = false;
|
|
41
|
+
private defer = new Defer();
|
|
27
42
|
|
|
28
43
|
/**
|
|
29
|
-
* @param {MediaConnectionAwaiterProps}
|
|
44
|
+
* @param {MediaConnectionAwaiterProps} props
|
|
30
45
|
*/
|
|
31
|
-
constructor(
|
|
32
|
-
this.
|
|
33
|
-
this.defer = new Defer();
|
|
34
|
-
this.retried = false;
|
|
35
|
-
this.iceConnected = false;
|
|
36
|
-
this.correlationId = correlationId;
|
|
37
|
-
this.onTimeoutCallback = this.onTimeout.bind(this);
|
|
38
|
-
this.peerConnectionStateCallback = this.peerConnectionStateHandler.bind(this);
|
|
39
|
-
this.iceConnectionStateCallback = this.iceConnectionStateHandler.bind(this);
|
|
40
|
-
this.iceGatheringStateCallback = this.iceGatheringStateHandler.bind(this);
|
|
46
|
+
constructor(props: MediaConnectionAwaiterProps) {
|
|
47
|
+
this.props = props;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @returns {boolean}
|
|
51
|
+
* Registers listeners and starts the wait once, settling terminal connections immediately.
|
|
52
|
+
* @returns {Promise<void>} Rejects with FailureResult on failure
|
|
47
53
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
waitForMediaConnectionConnected(): Promise<void> {
|
|
55
|
+
if (this.state.name === 'idle') {
|
|
56
|
+
this.registerCallbacks();
|
|
57
|
+
this.evaluate('waitForMediaConnectionConnected');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return this.defer.promise;
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
64
|
+
* Applies a transition to a new state and owns its deadline or terminal settlement.
|
|
65
|
+
* @param {EnteredState} next - State to enter; an active wait cannot return to idle
|
|
66
|
+
* @param {string} reason - Trigger or reason for the transition
|
|
67
|
+
* @returns {void}
|
|
56
68
|
*/
|
|
57
|
-
private
|
|
58
|
-
|
|
69
|
+
private enter(next: EnteredState, reason: string): void {
|
|
70
|
+
if (this.isTerminal()) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
LoggerProxy.logger.log(
|
|
75
|
+
`Media:MediaConnectionAwaiter#enter --> ${this.state.name} -> ${next.name}: ${reason}`
|
|
76
|
+
);
|
|
77
|
+
this.state = next;
|
|
78
|
+
|
|
79
|
+
switch (next.name) {
|
|
80
|
+
case 'ice':
|
|
81
|
+
case 'dtls':
|
|
82
|
+
this.armTimer(next, reason);
|
|
83
|
+
break;
|
|
84
|
+
case 'connected':
|
|
85
|
+
this.teardown();
|
|
86
|
+
this.defer.resolve();
|
|
87
|
+
break;
|
|
88
|
+
case 'failed':
|
|
89
|
+
this.teardown();
|
|
90
|
+
this.defer.reject(next.result);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
59
93
|
}
|
|
60
94
|
|
|
61
95
|
/**
|
|
62
|
-
* Returns
|
|
63
|
-
*
|
|
96
|
+
* Returns whether the promise has settled.
|
|
64
97
|
* @returns {boolean}
|
|
65
98
|
*/
|
|
66
|
-
private
|
|
67
|
-
return this.
|
|
99
|
+
private isTerminal(): boolean {
|
|
100
|
+
return this.state.name === 'connected' || this.state.name === 'failed';
|
|
68
101
|
}
|
|
69
102
|
|
|
70
103
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @returns {void}
|
|
104
|
+
* Returns the current state only if it owns a connection deadline.
|
|
105
|
+
* @returns {ActiveState | undefined}
|
|
74
106
|
*/
|
|
75
|
-
private
|
|
76
|
-
this
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
80
|
-
this.webrtcMediaConnection.off(
|
|
81
|
-
MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED,
|
|
82
|
-
this.peerConnectionStateCallback
|
|
83
|
-
);
|
|
84
|
-
this.webrtcMediaConnection.off(
|
|
85
|
-
MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED,
|
|
86
|
-
this.iceConnectionStateCallback
|
|
87
|
-
);
|
|
107
|
+
private getActiveState(): ActiveState | undefined {
|
|
108
|
+
const {state} = this;
|
|
109
|
+
|
|
110
|
+
return state.name === 'ice' || state.name === 'dtls' ? state : undefined;
|
|
88
111
|
}
|
|
89
112
|
|
|
90
113
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* @returns {
|
|
114
|
+
* Logs current browser state and transitions when connectivity or phase changes.
|
|
115
|
+
* @param {string} trigger - Callback or operation that triggered evaluation
|
|
116
|
+
* @returns {boolean} Whether a state transition occurred
|
|
94
117
|
*/
|
|
95
|
-
|
|
118
|
+
private evaluate(trigger: string): boolean {
|
|
119
|
+
const connection = this.props.webrtcMediaConnection;
|
|
120
|
+
const connectionState = connection.getConnectionState();
|
|
121
|
+
|
|
96
122
|
LoggerProxy.logger.log(
|
|
97
|
-
`Media:MediaConnectionAwaiter#
|
|
123
|
+
`Media:MediaConnectionAwaiter#evaluate --> triggered by ${trigger}, connection state: ${connectionState}, peer connection state: ${connection.getPeerConnectionState()}, ICE connection state: ${connection.getIceConnectionState()}, ICE gathering state: ${connection.getIceGatheringState()}, awaiter state: ${
|
|
124
|
+
this.state.name
|
|
125
|
+
}`
|
|
98
126
|
);
|
|
99
127
|
|
|
100
|
-
if (this.
|
|
101
|
-
|
|
102
|
-
'Media:MediaConnectionAwaiter#connectionStateChange --> ICE failed, rejecting'
|
|
103
|
-
);
|
|
104
|
-
this.clearCallbacks();
|
|
105
|
-
|
|
106
|
-
this.defer.reject({
|
|
107
|
-
iceConnected: this.iceConnected,
|
|
108
|
-
});
|
|
128
|
+
if (this.isTerminal()) {
|
|
129
|
+
return false;
|
|
109
130
|
}
|
|
110
131
|
|
|
111
|
-
|
|
112
|
-
|
|
132
|
+
const connectivity = this.getConnectivity();
|
|
133
|
+
if (connectionState === ConnectionState.Connected) {
|
|
134
|
+
this.enter({name: 'connected'}, trigger);
|
|
135
|
+
|
|
136
|
+
return true;
|
|
113
137
|
}
|
|
138
|
+
if (connectionState === ConnectionState.Failed || connectionState === ConnectionState.Closed) {
|
|
139
|
+
this.enter({name: 'failed', result: connectivity}, trigger);
|
|
114
140
|
|
|
115
|
-
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
116
143
|
|
|
117
|
-
|
|
144
|
+
const phase = connectivity.iceConnected ? 'dtls' : 'ice';
|
|
145
|
+
if (this.state.name === phase) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
118
148
|
|
|
119
|
-
|
|
149
|
+
this.enter(phase === 'ice' ? {name: 'ice', gatheringRetried: false} : {name: 'dtls'}, trigger);
|
|
120
150
|
|
|
121
|
-
|
|
151
|
+
return true;
|
|
122
152
|
}
|
|
123
153
|
|
|
124
154
|
/**
|
|
125
|
-
* Listener for peer connection state
|
|
126
|
-
*
|
|
155
|
+
* Listener for peer connection state changes.
|
|
127
156
|
* @returns {void}
|
|
128
157
|
*/
|
|
129
|
-
peerConnectionStateHandler(): void {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
LoggerProxy.logger.log(
|
|
133
|
-
`Media:MediaConnectionAwaiter#peerConnectionStateHandler --> Peer connection state change -> ${peerConnectionState}`
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
this.connectionStateChange();
|
|
137
|
-
}
|
|
158
|
+
peerConnectionStateHandler = (): void => {
|
|
159
|
+
this.evaluate('peerConnectionStateHandler');
|
|
160
|
+
};
|
|
138
161
|
|
|
139
162
|
/**
|
|
140
|
-
* Listener for ICE connection state
|
|
141
|
-
*
|
|
163
|
+
* Listener for ICE connection state changes.
|
|
142
164
|
* @returns {void}
|
|
143
165
|
*/
|
|
144
|
-
iceConnectionStateHandler(): void {
|
|
145
|
-
|
|
166
|
+
iceConnectionStateHandler = (): void => {
|
|
167
|
+
this.evaluate('iceConnectionStateHandler');
|
|
168
|
+
};
|
|
146
169
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Restarts only an unchanged ICE phase when gathering completes.
|
|
172
|
+
* @returns {void}
|
|
173
|
+
*/
|
|
174
|
+
iceGatheringStateHandler = (): void => {
|
|
175
|
+
const changed = this.evaluate('iceGatheringStateHandler');
|
|
176
|
+
if (!changed && this.state.name === 'ice' && this.isIceGatheringCompleted()) {
|
|
177
|
+
this.armTimer(this.state, 'iceGatheringStateHandler: ICE gathering completed');
|
|
153
178
|
}
|
|
154
|
-
|
|
155
|
-
this.connectionStateChange();
|
|
156
|
-
}
|
|
179
|
+
};
|
|
157
180
|
|
|
158
181
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
182
|
+
* Rechecks connectivity before applying the deadline or the ICE gathering retry.
|
|
161
183
|
* @returns {void}
|
|
162
184
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
`Media:MediaConnectionAwaiter#iceGatheringStateHandler --> ICE gathering state change -> ${iceGatheringState}`
|
|
168
|
-
);
|
|
185
|
+
onTimeout = (): void => {
|
|
186
|
+
if (this.evaluate('onTimeout')) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
169
189
|
|
|
170
|
-
|
|
190
|
+
const state = this.getActiveState();
|
|
191
|
+
if (!state) {
|
|
171
192
|
return;
|
|
172
193
|
}
|
|
173
194
|
|
|
174
|
-
|
|
195
|
+
this.sendMetric().catch((error) => {
|
|
196
|
+
LoggerProxy.logger.warn('Media:MediaConnectionAwaiter#onTimeout --> metric failed', error);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
if (state.name === 'ice' && !state.gatheringRetried && !this.isIceGatheringCompleted()) {
|
|
200
|
+
this.enter(
|
|
201
|
+
{...state, gatheringRetried: true},
|
|
202
|
+
'onTimeout: ICE gathering incomplete, retrying once'
|
|
203
|
+
);
|
|
204
|
+
|
|
175
205
|
return;
|
|
176
206
|
}
|
|
177
207
|
|
|
178
|
-
|
|
208
|
+
this.enter({name: 'failed', result: this.getConnectivity()}, `${state.name} timeout`);
|
|
209
|
+
};
|
|
179
210
|
|
|
180
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Arms an active phase's deadline and logs every start or restart.
|
|
213
|
+
* @param {ActiveState} state - Active state whose deadline is being started
|
|
214
|
+
* @param {string} reason - Why the deadline is being started or restarted
|
|
215
|
+
* @returns {void}
|
|
216
|
+
*/
|
|
217
|
+
private armTimer(state: ActiveState, reason: string): void {
|
|
218
|
+
if (this.timer !== undefined) {
|
|
219
|
+
clearTimeout(this.timer);
|
|
220
|
+
}
|
|
221
|
+
const timeout = PHASE_TIMEOUT[state.name];
|
|
222
|
+
this.timer = setTimeout(this.onTimeout, timeout);
|
|
223
|
+
LoggerProxy.logger.log(
|
|
224
|
+
`Media:MediaConnectionAwaiter#armTimer --> ${state.name} (${timeout}ms): ${reason}`
|
|
225
|
+
);
|
|
181
226
|
}
|
|
182
227
|
|
|
183
228
|
/**
|
|
184
|
-
*
|
|
185
|
-
* issues where browser doesn't update the RTCPeerConnection's iceConnectionState or connectionState
|
|
186
|
-
*
|
|
229
|
+
* Releases the deadline and registered listeners on either terminal transition.
|
|
187
230
|
* @returns {void}
|
|
188
231
|
*/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// but for the purpose of this metric it's fine to just use the first one
|
|
194
|
-
const transportReports = Array.from(
|
|
195
|
-
stats.values().filter((report) => report.type === 'transport')
|
|
196
|
-
) as Record<string, number | string>[];
|
|
197
|
-
|
|
198
|
-
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEDIA_STILL_NOT_CONNECTED, {
|
|
199
|
-
correlation_id: this.correlationId,
|
|
200
|
-
numTransports: transportReports.length,
|
|
201
|
-
dtlsState: transportReports[0]?.dtlsState,
|
|
202
|
-
iceState: transportReports[0]?.iceState,
|
|
203
|
-
packetsSent: transportReports[0]?.packetsSent,
|
|
204
|
-
packetsReceived: transportReports[0]?.packetsReceived,
|
|
205
|
-
dataChannelState: this.webrtcMediaConnection.multistreamConnection?.dataChannel?.readyState,
|
|
206
|
-
});
|
|
232
|
+
private teardown(): void {
|
|
233
|
+
clearTimeout(this.timer);
|
|
234
|
+
this.timer = undefined;
|
|
235
|
+
this.unregisterCallbacks();
|
|
207
236
|
}
|
|
208
237
|
|
|
209
238
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
239
|
+
* Registers each callback once with a stable function reference.
|
|
212
240
|
* @returns {void}
|
|
213
241
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
'Media:MediaConnectionAwaiter#onTimeout --> ICE gathering did not complete within the timeout for the first time, retrying once'
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
// retry once if ICE gathering is not completed
|
|
232
|
-
this.retried = true;
|
|
233
|
-
clearTimeout(this.timer);
|
|
234
|
-
this.timer = setTimeout(this.onTimeoutCallback, ICE_AND_DTLS_CONNECTION_TIMEOUT);
|
|
235
|
-
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
LoggerProxy.logger.warn(
|
|
240
|
-
'Media:MediaConnectionAwaiter#onTimeout --> ICE gathering did not complete within the timeout for the second time, rejecting'
|
|
241
|
-
);
|
|
242
|
-
} else {
|
|
243
|
-
LoggerProxy.logger.warn(
|
|
244
|
-
'Media:MediaConnectionAwaiter#onTimeout --> ICE gathering completed, but connection state is not connected, rejecting'
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
this.clearCallbacks();
|
|
249
|
-
|
|
250
|
-
this.defer.reject({
|
|
251
|
-
iceConnected: this.iceConnected,
|
|
252
|
-
});
|
|
242
|
+
private registerCallbacks(): void {
|
|
243
|
+
const connection = this.props.webrtcMediaConnection;
|
|
244
|
+
connection.on(
|
|
245
|
+
MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED,
|
|
246
|
+
this.peerConnectionStateHandler
|
|
247
|
+
);
|
|
248
|
+
connection.on(
|
|
249
|
+
MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED,
|
|
250
|
+
this.iceConnectionStateHandler
|
|
251
|
+
);
|
|
252
|
+
connection.on(
|
|
253
|
+
MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED,
|
|
254
|
+
this.iceGatheringStateHandler
|
|
255
|
+
);
|
|
253
256
|
}
|
|
254
257
|
|
|
255
258
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* @returns {Promise}
|
|
259
|
+
* Removes callbacks when the wait reaches a terminal state.
|
|
260
|
+
* @returns {void}
|
|
259
261
|
*/
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return Promise.resolve();
|
|
267
|
-
}
|
|
268
|
-
LoggerProxy.logger.log(
|
|
269
|
-
'Media:MediaConnectionAwaiter#waitForMediaConnectionConnected --> Waiting for media connection to be connected'
|
|
262
|
+
private unregisterCallbacks(): void {
|
|
263
|
+
const connection = this.props.webrtcMediaConnection;
|
|
264
|
+
connection.off(
|
|
265
|
+
MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED,
|
|
266
|
+
this.iceGatheringStateHandler
|
|
270
267
|
);
|
|
271
|
-
|
|
272
|
-
this.webrtcMediaConnection.on(
|
|
268
|
+
connection.off(
|
|
273
269
|
MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED,
|
|
274
|
-
this.
|
|
270
|
+
this.peerConnectionStateHandler
|
|
275
271
|
);
|
|
276
|
-
|
|
277
|
-
this.webrtcMediaConnection.on(
|
|
272
|
+
connection.off(
|
|
278
273
|
MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED,
|
|
279
|
-
this.
|
|
274
|
+
this.iceConnectionStateHandler
|
|
280
275
|
);
|
|
276
|
+
}
|
|
281
277
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Returns whether ICE gathering has completed.
|
|
280
|
+
* @returns {boolean}
|
|
281
|
+
*/
|
|
282
|
+
private isIceGatheringCompleted(): boolean {
|
|
283
|
+
return this.props.webrtcMediaConnection.getIceGatheringState() === 'complete';
|
|
284
|
+
}
|
|
286
285
|
|
|
287
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Captures current and historical ICE connectivity for failures and metrics.
|
|
288
|
+
* @returns {FailureResult}
|
|
289
|
+
*/
|
|
290
|
+
private getConnectivity(): FailureResult {
|
|
291
|
+
const iceState = this.props.webrtcMediaConnection.getIceConnectionState();
|
|
292
|
+
const iceConnected = iceState === 'connected' || iceState === 'completed';
|
|
293
|
+
this.iceConnectedAtLeastOnce ||= iceConnected;
|
|
288
294
|
|
|
289
|
-
return this.
|
|
295
|
+
return {iceConnected, iceConnectedAtLeastOnce: this.iceConnectedAtLeastOnce};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Sends connectivity diagnostics when a deadline expires.
|
|
300
|
+
* @returns {Promise<void>}
|
|
301
|
+
*/
|
|
302
|
+
private async sendMetric(): Promise<void> {
|
|
303
|
+
// Capture connectivity before awaiting stats, which may finish after another state change.
|
|
304
|
+
const connectivity = this.getConnectivity();
|
|
305
|
+
const connection = this.props.webrtcMediaConnection;
|
|
306
|
+
const stats = await connection.getStats();
|
|
307
|
+
|
|
308
|
+
// There may be multiple transport reports; the first is sufficient for this metric.
|
|
309
|
+
const transportReports = Array.from(
|
|
310
|
+
stats.values().filter((report) => report.type === 'transport')
|
|
311
|
+
) as Record<string, number | string>[];
|
|
312
|
+
|
|
313
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEDIA_STILL_NOT_CONNECTED, {
|
|
314
|
+
correlation_id: this.props.correlationId,
|
|
315
|
+
...connectivity,
|
|
316
|
+
numTransports: transportReports.length,
|
|
317
|
+
dtlsState: transportReports[0]?.dtlsState,
|
|
318
|
+
iceState: transportReports[0]?.iceState,
|
|
319
|
+
packetsSent: transportReports[0]?.packetsSent,
|
|
320
|
+
packetsReceived: transportReports[0]?.packetsReceived,
|
|
321
|
+
dataChannelState: connection.multistreamConnection?.dataChannel?.readyState,
|
|
322
|
+
});
|
|
290
323
|
}
|
|
291
324
|
}
|