@webex/plugin-meetings 3.6.0-next.9 → 3.7.0-ipv6-multi-turn-urls.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.
Files changed (159) hide show
  1. package/README.md +2 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/index.js +1 -1
  4. package/dist/common/errors/{webinar-registration-error.js → join-webinar-error.js} +12 -12
  5. package/dist/common/errors/join-webinar-error.js.map +1 -0
  6. package/dist/config.js +3 -1
  7. package/dist/config.js.map +1 -1
  8. package/dist/constants.js +50 -7
  9. package/dist/constants.js.map +1 -1
  10. package/dist/controls-options-manager/enums.js +1 -0
  11. package/dist/controls-options-manager/enums.js.map +1 -1
  12. package/dist/controls-options-manager/index.js +10 -3
  13. package/dist/controls-options-manager/index.js.map +1 -1
  14. package/dist/controls-options-manager/types.js.map +1 -1
  15. package/dist/controls-options-manager/util.js +12 -0
  16. package/dist/controls-options-manager/util.js.map +1 -1
  17. package/dist/index.js +7 -7
  18. package/dist/index.js.map +1 -1
  19. package/dist/interpretation/index.js +1 -1
  20. package/dist/interpretation/siLanguage.js +1 -1
  21. package/dist/locus-info/controlsUtils.js +28 -4
  22. package/dist/locus-info/controlsUtils.js.map +1 -1
  23. package/dist/locus-info/fullState.js +2 -1
  24. package/dist/locus-info/fullState.js.map +1 -1
  25. package/dist/locus-info/index.js +61 -3
  26. package/dist/locus-info/index.js.map +1 -1
  27. package/dist/media/index.js +29 -1
  28. package/dist/media/index.js.map +1 -1
  29. package/dist/meeting/in-meeting-actions.js +29 -1
  30. package/dist/meeting/in-meeting-actions.js.map +1 -1
  31. package/dist/meeting/index.js +692 -472
  32. package/dist/meeting/index.js.map +1 -1
  33. package/dist/meeting/locusMediaRequest.js +2 -6
  34. package/dist/meeting/locusMediaRequest.js.map +1 -1
  35. package/dist/meeting/request.js +21 -29
  36. package/dist/meeting/request.js.map +1 -1
  37. package/dist/meeting/util.js +95 -59
  38. package/dist/meeting/util.js.map +1 -1
  39. package/dist/meeting-info/meeting-info-v2.js +29 -17
  40. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  41. package/dist/meetings/index.js +8 -3
  42. package/dist/meetings/index.js.map +1 -1
  43. package/dist/members/index.js +3 -2
  44. package/dist/members/index.js.map +1 -1
  45. package/dist/members/util.js +13 -7
  46. package/dist/members/util.js.map +1 -1
  47. package/dist/metrics/constants.js +3 -1
  48. package/dist/metrics/constants.js.map +1 -1
  49. package/dist/multistream/remoteMedia.js +30 -15
  50. package/dist/multistream/remoteMedia.js.map +1 -1
  51. package/dist/reachability/clusterReachability.js +12 -15
  52. package/dist/reachability/clusterReachability.js.map +1 -1
  53. package/dist/reachability/index.js +433 -136
  54. package/dist/reachability/index.js.map +1 -1
  55. package/dist/reachability/reachability.types.js +7 -0
  56. package/dist/reachability/reachability.types.js.map +1 -0
  57. package/dist/reachability/request.js +23 -9
  58. package/dist/reachability/request.js.map +1 -1
  59. package/dist/recording-controller/enums.js +8 -4
  60. package/dist/recording-controller/enums.js.map +1 -1
  61. package/dist/recording-controller/index.js +18 -9
  62. package/dist/recording-controller/index.js.map +1 -1
  63. package/dist/recording-controller/util.js +13 -9
  64. package/dist/recording-controller/util.js.map +1 -1
  65. package/dist/roap/index.js +5 -7
  66. package/dist/roap/index.js.map +1 -1
  67. package/dist/roap/request.js +45 -79
  68. package/dist/roap/request.js.map +1 -1
  69. package/dist/roap/turnDiscovery.js +3 -6
  70. package/dist/roap/turnDiscovery.js.map +1 -1
  71. package/dist/types/common/errors/{webinar-registration-error.d.ts → join-webinar-error.d.ts} +2 -2
  72. package/dist/types/config.d.ts +2 -0
  73. package/dist/types/constants.d.ts +38 -1
  74. package/dist/types/controls-options-manager/enums.d.ts +2 -1
  75. package/dist/types/controls-options-manager/index.d.ts +2 -1
  76. package/dist/types/controls-options-manager/types.d.ts +2 -0
  77. package/dist/types/index.d.ts +2 -2
  78. package/dist/types/locus-info/index.d.ts +9 -0
  79. package/dist/types/meeting/in-meeting-actions.d.ts +28 -0
  80. package/dist/types/meeting/index.d.ts +34 -3
  81. package/dist/types/meeting/locusMediaRequest.d.ts +2 -3
  82. package/dist/types/meeting/request.d.ts +2 -2
  83. package/dist/types/meeting/util.d.ts +2 -2
  84. package/dist/types/meeting-info/meeting-info-v2.d.ts +4 -4
  85. package/dist/types/meetings/index.d.ts +4 -1
  86. package/dist/types/members/index.d.ts +2 -1
  87. package/dist/types/members/util.d.ts +5 -1
  88. package/dist/types/metrics/constants.d.ts +3 -1
  89. package/dist/types/reachability/clusterReachability.d.ts +1 -10
  90. package/dist/types/reachability/index.d.ts +74 -35
  91. package/dist/types/reachability/reachability.types.d.ts +64 -0
  92. package/dist/types/reachability/request.d.ts +5 -1
  93. package/dist/types/recording-controller/enums.d.ts +5 -2
  94. package/dist/types/recording-controller/index.d.ts +1 -0
  95. package/dist/types/recording-controller/util.d.ts +2 -1
  96. package/dist/types/roap/request.d.ts +1 -13
  97. package/dist/webinar/index.js +382 -19
  98. package/dist/webinar/index.js.map +1 -1
  99. package/package.json +22 -22
  100. package/src/common/errors/join-webinar-error.ts +24 -0
  101. package/src/config.ts +2 -0
  102. package/src/constants.ts +49 -3
  103. package/src/controls-options-manager/enums.ts +1 -0
  104. package/src/controls-options-manager/index.ts +19 -2
  105. package/src/controls-options-manager/types.ts +2 -0
  106. package/src/controls-options-manager/util.ts +12 -0
  107. package/src/index.ts +2 -2
  108. package/src/locus-info/controlsUtils.ts +46 -2
  109. package/src/locus-info/fullState.ts +1 -0
  110. package/src/locus-info/index.ts +60 -0
  111. package/src/media/index.ts +15 -0
  112. package/src/meeting/in-meeting-actions.ts +58 -0
  113. package/src/meeting/index.ts +232 -25
  114. package/src/meeting/locusMediaRequest.ts +4 -8
  115. package/src/meeting/request.ts +4 -11
  116. package/src/meeting/util.ts +25 -4
  117. package/src/meeting-info/meeting-info-v2.ts +23 -11
  118. package/src/meetings/index.ts +54 -41
  119. package/src/members/index.ts +4 -2
  120. package/src/members/util.ts +4 -1
  121. package/src/metrics/constants.ts +3 -1
  122. package/src/multistream/remoteMedia.ts +28 -15
  123. package/src/reachability/clusterReachability.ts +5 -15
  124. package/src/reachability/index.ts +285 -77
  125. package/src/reachability/reachability.types.ts +85 -0
  126. package/src/reachability/request.ts +55 -30
  127. package/src/recording-controller/enums.ts +5 -2
  128. package/src/recording-controller/index.ts +17 -4
  129. package/src/recording-controller/util.ts +20 -5
  130. package/src/roap/index.ts +4 -5
  131. package/src/roap/request.ts +30 -44
  132. package/src/roap/turnDiscovery.ts +2 -4
  133. package/src/webinar/index.ts +223 -17
  134. package/test/unit/spec/controls-options-manager/index.js +56 -32
  135. package/test/unit/spec/controls-options-manager/util.js +44 -0
  136. package/test/unit/spec/locus-info/controlsUtils.js +80 -4
  137. package/test/unit/spec/locus-info/index.js +59 -2
  138. package/test/unit/spec/meeting/in-meeting-actions.ts +31 -1
  139. package/test/unit/spec/meeting/index.js +369 -103
  140. package/test/unit/spec/meeting/locusMediaRequest.ts +18 -11
  141. package/test/unit/spec/meeting/request.js +3 -26
  142. package/test/unit/spec/meeting/utils.js +55 -13
  143. package/test/unit/spec/meeting-info/meetinginfov2.js +9 -4
  144. package/test/unit/spec/meetings/index.js +25 -6
  145. package/test/unit/spec/members/index.js +25 -2
  146. package/test/unit/spec/members/request.js +37 -3
  147. package/test/unit/spec/members/utils.js +110 -1
  148. package/test/unit/spec/multistream/remoteMedia.ts +11 -7
  149. package/test/unit/spec/reachability/clusterReachability.ts +7 -0
  150. package/test/unit/spec/reachability/index.ts +265 -1
  151. package/test/unit/spec/reachability/request.js +56 -15
  152. package/test/unit/spec/recording-controller/index.js +61 -5
  153. package/test/unit/spec/recording-controller/util.js +39 -3
  154. package/test/unit/spec/roap/index.ts +1 -1
  155. package/test/unit/spec/roap/request.ts +51 -109
  156. package/test/unit/spec/roap/turnDiscovery.ts +202 -147
  157. package/test/unit/spec/webinar/index.ts +443 -14
  158. package/dist/common/errors/webinar-registration-error.js.map +0 -1
  159. package/src/common/errors/webinar-registration-error.ts +0 -27
@@ -18,7 +18,19 @@ const ADHOC_MEETING_DEFAULT_ERROR =
18
18
  'Failed starting the adhoc meeting, Please contact support team ';
19
19
  const CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES = [423005, 423006];
20
20
  const POLICY_ERROR_CODES = [403049, 403104, 403103, 403048, 403102, 403101];
21
- const WEBINAR_REGISTRATION_ERROR_CODES = [403021, 403022, 403024];
21
+ /**
22
+ * 403021 - Meeting registration is required
23
+ * 403022 - Meeting registration is still pending
24
+ * 403024 - Meeting registration have been rejected
25
+ * 403137 - Registration ID verified failure
26
+ * 423007 - Registration ID input too many time,please input captcha code
27
+ * 403026 - Need to join meeting via webcast
28
+ * 403037 - Meeting join required registration ID
29
+ * 403137 - Registration ID verified failure
30
+ *
31
+ */
32
+ const JOIN_WEBINAR_ERROR_CODES = [403021, 403022, 403024, 403137, 423007, 403026, 403037, 403137];
33
+
22
34
  /**
23
35
  * Error to indicate that wbxappapi requires a password
24
36
  */
@@ -126,9 +138,9 @@ export class MeetingInfoV2CaptchaError extends Error {
126
138
  }
127
139
 
128
140
  /**
129
- * Error preventing join because of a webinar registration error
141
+ * Error preventing join because of a webinar have some error
130
142
  */
131
- export class MeetingInfoV2WebinarRegistrationError extends Error {
143
+ export class MeetingInfoV2JoinWebinarError extends Error {
132
144
  meetingInfo: any;
133
145
  sdkMessage: any;
134
146
  wbxAppApiCode: any;
@@ -142,7 +154,7 @@ export class MeetingInfoV2WebinarRegistrationError extends Error {
142
154
  */
143
155
  constructor(wbxAppApiErrorCode?: number, meetingInfo?: object, message?: string) {
144
156
  super(`${message}, code=${wbxAppApiErrorCode}`);
145
- this.name = 'MeetingInfoV2WebinarRegistrationError';
157
+ this.name = 'MeetingInfoV2JoinWebinarError';
146
158
  this.sdkMessage = message;
147
159
  this.stack = new Error().stack;
148
160
  this.wbxAppApiCode = wbxAppApiErrorCode;
@@ -204,21 +216,21 @@ export default class MeetingInfoV2 {
204
216
  };
205
217
 
206
218
  /**
207
- * Raises a handleWebinarRegistrationError for webinar registration error codes
219
+ * Raises a handleJoinWebinarError for join webinar error codes
208
220
  * @param {any} err the error from the request
209
221
  * @returns {void}
210
222
  */
211
- handleWebinarRegistrationError = (err) => {
223
+ handleJoinWebinarError = (err) => {
212
224
  if (!err.body) {
213
225
  return;
214
226
  }
215
227
 
216
- if (WEBINAR_REGISTRATION_ERROR_CODES.includes(err.body?.code)) {
217
- Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.WEBINAR_REGISTRATION_ERROR, {
228
+ if (JOIN_WEBINAR_ERROR_CODES.includes(err.body?.code)) {
229
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.JOIN_WEBINAR_ERROR, {
218
230
  code: err.body?.code,
219
231
  });
220
232
 
221
- throw new MeetingInfoV2WebinarRegistrationError(
233
+ throw new MeetingInfoV2JoinWebinarError(
222
234
  err.body?.code,
223
235
  err.body?.data?.meetingInfo,
224
236
  err.body?.message
@@ -286,7 +298,7 @@ export default class MeetingInfoV2 {
286
298
  })
287
299
  .catch((err) => {
288
300
  this.handlePolicyError(err);
289
- this.handleWebinarRegistrationError(err);
301
+ this.handleJoinWebinarError(err);
290
302
 
291
303
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE, {
292
304
  reason: err.message,
@@ -441,7 +453,7 @@ export default class MeetingInfoV2 {
441
453
 
442
454
  if (err?.statusCode === 403) {
443
455
  this.handlePolicyError(err);
444
- this.handleWebinarRegistrationError(err);
456
+ this.handleJoinWebinarError(err);
445
457
 
446
458
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.VERIFY_PASSWORD_ERROR, {
447
459
  reason: err.message,
@@ -56,7 +56,7 @@ import MeetingCollection from './collection';
56
56
  import {MEETING_KEY, INoiseReductionEffect, IVirtualBackgroundEffect} from './meetings.types';
57
57
  import MeetingsUtil from './util';
58
58
  import PermissionError from '../common/errors/permission';
59
- import WebinarRegistrationError from '../common/errors/webinar-registration-error';
59
+ import JoinWebinarError from '../common/errors/join-webinar-error';
60
60
  import {SpaceIDDeprecatedError} from '../common/errors/webex-errors';
61
61
  import NoMeetingInfoError from '../common/errors/no-meeting-info';
62
62
 
@@ -155,6 +155,9 @@ export type BasicMeetingInformation = {
155
155
  };
156
156
  meetingInfo: any;
157
157
  sessionCorrelationId: string;
158
+ roles: string[];
159
+ getCurUserType: () => string | null;
160
+ callStateForMetrics: CallStateForMetrics;
158
161
  };
159
162
 
160
163
  /**
@@ -1044,48 +1047,55 @@ export default class Meetings extends WebexPlugin {
1044
1047
  */
1045
1048
  fetchUserPreferredWebexSite() {
1046
1049
  // @ts-ignore
1047
- return this.webex.people._getMe().then((me) => {
1048
- const isGuestUser = me.type === 'appuser';
1049
- if (!isGuestUser) {
1050
- return this.request.getMeetingPreferences().then((res) => {
1051
- if (res) {
1052
- const preferredWebexSite = MeetingsUtil.parseDefaultSiteFromMeetingPreferences(res);
1053
- this.preferredWebexSite = preferredWebexSite;
1054
- // @ts-ignore
1055
- this.webex.internal.services._getCatalog().addAllowedDomains([preferredWebexSite]);
1056
- }
1050
+ return this.webex.people
1051
+ ._getMe()
1052
+ .then((me) => {
1053
+ const isGuestUser = me.type === 'appuser';
1054
+ if (!isGuestUser) {
1055
+ return this.request.getMeetingPreferences().then((res) => {
1056
+ if (res) {
1057
+ const preferredWebexSite = MeetingsUtil.parseDefaultSiteFromMeetingPreferences(res);
1058
+ this.preferredWebexSite = preferredWebexSite;
1059
+ // @ts-ignore
1060
+ this.webex.internal.services._getCatalog().addAllowedDomains([preferredWebexSite]);
1061
+ }
1057
1062
 
1058
- // fall back to getting the preferred site from the user information
1059
- if (!this.preferredWebexSite) {
1060
- // @ts-ignore
1061
- return this.webex.internal.user
1062
- .get()
1063
- .then((user) => {
1064
- const preferredWebexSite =
1065
- user?.userPreferences?.userPreferencesItems?.preferredWebExSite;
1066
- if (preferredWebexSite) {
1067
- this.preferredWebexSite = preferredWebexSite;
1068
- // @ts-ignore
1069
- this.webex.internal.services
1070
- ._getCatalog()
1071
- .addAllowedDomains([preferredWebexSite]);
1072
- } else {
1073
- throw new Error('site not found');
1074
- }
1075
- })
1076
- .catch(() => {
1077
- LoggerProxy.logger.error(
1078
- 'Failed to fetch preferred site from user - no site will be set'
1079
- );
1080
- });
1081
- }
1063
+ // fall back to getting the preferred site from the user information
1064
+ if (!this.preferredWebexSite) {
1065
+ // @ts-ignore
1066
+ return this.webex.internal.user
1067
+ .get()
1068
+ .then((user) => {
1069
+ const preferredWebexSite =
1070
+ user?.userPreferences?.userPreferencesItems?.preferredWebExSite;
1071
+ if (preferredWebexSite) {
1072
+ this.preferredWebexSite = preferredWebexSite;
1073
+ // @ts-ignore
1074
+ this.webex.internal.services
1075
+ ._getCatalog()
1076
+ .addAllowedDomains([preferredWebexSite]);
1077
+ } else {
1078
+ throw new Error('site not found');
1079
+ }
1080
+ })
1081
+ .catch(() => {
1082
+ LoggerProxy.logger.error(
1083
+ 'Failed to fetch preferred site from user - no site will be set'
1084
+ );
1085
+ });
1086
+ }
1082
1087
 
1083
- return Promise.resolve();
1084
- });
1085
- }
1088
+ return Promise.resolve();
1089
+ });
1090
+ }
1086
1091
 
1087
- return Promise.resolve();
1088
- });
1092
+ return Promise.resolve();
1093
+ })
1094
+ .catch(() => {
1095
+ LoggerProxy.logger.error(
1096
+ 'Failed to retrieve user information. No preferredWebexSite will be set'
1097
+ );
1098
+ });
1089
1099
  }
1090
1100
 
1091
1101
  /**
@@ -1136,6 +1146,9 @@ export default class Meetings extends WebexPlugin {
1136
1146
  sessionId: meeting.locusInfo?.fullState?.sessionId,
1137
1147
  },
1138
1148
  },
1149
+ roles: meeting.roles,
1150
+ callStateForMetrics: meeting.callStateForMetrics,
1151
+ getCurUserType: meeting.getCurUserType,
1139
1152
  });
1140
1153
  this.meetingCollection.delete(meeting.id);
1141
1154
  Trigger.trigger(
@@ -1399,7 +1412,7 @@ export default class Meetings extends WebexPlugin {
1399
1412
  !(err instanceof CaptchaError) &&
1400
1413
  !(err instanceof PasswordError) &&
1401
1414
  !(err instanceof PermissionError) &&
1402
- !(err instanceof WebinarRegistrationError)
1415
+ !(err instanceof JoinWebinarError)
1403
1416
  ) {
1404
1417
  LoggerProxy.logger.info(
1405
1418
  `Meetings:index#createMeeting --> Info Unable to fetch meeting info for ${destination}.`
@@ -915,11 +915,12 @@ export default class Members extends StatelessWebexPlugin {
915
915
  /**
916
916
  * Lower all hands of members in a meeting
917
917
  * @param {String} requestingMemberId - id of the participant which requested the lower all hands
918
+ * @param {array} roles which should be lowered
918
919
  * @returns {Promise}
919
920
  * @public
920
921
  * @memberof Members
921
922
  */
922
- public lowerAllHands(requestingMemberId: string) {
923
+ public lowerAllHands(requestingMemberId: string, roles: Array<string>) {
923
924
  if (!this.locusUrl) {
924
925
  return Promise.reject(
925
926
  new ParameterError(
@@ -936,7 +937,8 @@ export default class Members extends StatelessWebexPlugin {
936
937
  }
937
938
  const options = MembersUtil.generateLowerAllHandsMemberOptions(
938
939
  requestingMemberId,
939
- this.locusUrl
940
+ this.locusUrl,
941
+ roles
940
942
  );
941
943
 
942
944
  return this.membersRequest.lowerAllHandsMember(options);
@@ -46,6 +46,7 @@ const MembersUtil = {
46
46
  {
47
47
  address:
48
48
  options.invitee.emailAddress || options.invitee.email || options.invitee.phoneNumber,
49
+ ...(options.invitee.roles ? {roles: options.invitee.roles} : {}),
49
50
  },
50
51
  ],
51
52
  alertIfActive: options.alertIfActive,
@@ -166,9 +167,10 @@ const MembersUtil = {
166
167
  locusUrl,
167
168
  }),
168
169
 
169
- generateLowerAllHandsMemberOptions: (requestingParticipantId, locusUrl) => ({
170
+ generateLowerAllHandsMemberOptions: (requestingParticipantId, locusUrl, roles) => ({
170
171
  requestingParticipantId,
171
172
  locusUrl,
173
+ ...(roles !== undefined && {roles}),
172
174
  }),
173
175
 
174
176
  /**
@@ -253,6 +255,7 @@ const MembersUtil = {
253
255
  const body = {
254
256
  hand: {
255
257
  raised: false,
258
+ ...(options.roles !== undefined && {roles: options.roles}),
256
259
  },
257
260
  requestingParticipantId: options.requestingParticipantId,
258
261
  };
@@ -70,7 +70,9 @@ const BEHAVIORAL_METRICS = {
70
70
  ROAP_HTTP_RESPONSE_MISSING: 'js_sdk_roap_http_response_missing',
71
71
  TURN_DISCOVERY_REQUIRES_OK: 'js_sdk_turn_discovery_requires_ok',
72
72
  REACHABILITY_COMPLETED: 'js_sdk_reachability_completed',
73
- WEBINAR_REGISTRATION_ERROR: 'js_sdk_webinar_registration_error',
73
+ JOIN_WEBINAR_ERROR: 'js_sdk_join_webinar_error',
74
+ GUEST_ENTERED_LOBBY: 'js_sdk_guest_entered_lobby',
75
+ GUEST_EXITED_LOBBY: 'js_sdk_guest_exited_lobby',
74
76
  };
75
77
 
76
78
  export {BEHAVIORAL_METRICS as default};
@@ -19,6 +19,14 @@ export type RemoteVideoResolution =
19
19
  | 'large' // 1080p or less
20
20
  | 'best'; // highest possible resolution
21
21
 
22
+ const MAX_FS_VALUES = {
23
+ '90p': 60,
24
+ '180p': 240,
25
+ '360p': 920,
26
+ '720p': 3600,
27
+ '1080p': 8192,
28
+ };
29
+
22
30
  /**
23
31
  * Converts pane size into h264 maxFs
24
32
  * @param {PaneSize} paneSize
@@ -29,28 +37,28 @@ export function getMaxFs(paneSize: RemoteVideoResolution): number {
29
37
 
30
38
  switch (paneSize) {
31
39
  case 'thumbnail':
32
- maxFs = 60;
40
+ maxFs = MAX_FS_VALUES['90p'];
33
41
  break;
34
42
  case 'very small':
35
- maxFs = 240;
43
+ maxFs = MAX_FS_VALUES['180p'];
36
44
  break;
37
45
  case 'small':
38
- maxFs = 920;
46
+ maxFs = MAX_FS_VALUES['360p'];
39
47
  break;
40
48
  case 'medium':
41
- maxFs = 3600;
49
+ maxFs = MAX_FS_VALUES['720p'];
42
50
  break;
43
51
  case 'large':
44
- maxFs = 8192;
52
+ maxFs = MAX_FS_VALUES['1080p'];
45
53
  break;
46
54
  case 'best':
47
- maxFs = 8192; // for now 'best' is 1080p, so same as 'large'
55
+ maxFs = MAX_FS_VALUES['1080p']; // for now 'best' is 1080p, so same as 'large'
48
56
  break;
49
57
  default:
50
58
  LoggerProxy.logger.warn(
51
59
  `RemoteMedia#getMaxFs --> unsupported paneSize: ${paneSize}, using "medium" instead`
52
60
  );
53
- maxFs = 3600;
61
+ maxFs = MAX_FS_VALUES['720p'];
54
62
  }
55
63
 
56
64
  return maxFs;
@@ -117,16 +125,21 @@ export class RemoteMedia extends EventsScope {
117
125
  return;
118
126
  }
119
127
 
120
- if (height < 135) {
121
- fs = 60;
122
- } else if (height < 270) {
123
- fs = 240;
124
- } else if (height < 540) {
125
- fs = 920;
128
+ // we switch to the next resolution level when the height is 10% more than the current resolution height
129
+ // except for 1080p - we switch to it immediately when the height is more than 720p
130
+ const threshold = 1.1;
131
+ const getThresholdHeight = (h: number) => Math.round(h * threshold);
132
+
133
+ if (height < getThresholdHeight(90)) {
134
+ fs = MAX_FS_VALUES['90p'];
135
+ } else if (height < getThresholdHeight(180)) {
136
+ fs = MAX_FS_VALUES['180p'];
137
+ } else if (height < getThresholdHeight(360)) {
138
+ fs = MAX_FS_VALUES['360p'];
126
139
  } else if (height <= 720) {
127
- fs = 3600;
140
+ fs = MAX_FS_VALUES['720p'];
128
141
  } else {
129
- fs = 8192;
142
+ fs = MAX_FS_VALUES['1080p'];
130
143
  }
131
144
 
132
145
  this.receiveSlot?.setMaxFs(fs);
@@ -6,20 +6,7 @@ import {convertStunUrlToTurn, convertStunUrlToTurnTls} from './util';
6
6
  import EventsScope from '../common/events/events-scope';
7
7
 
8
8
  import {CONNECTION_STATE, Enum, ICE_GATHERING_STATE} from '../constants';
9
-
10
- // result for a specific transport protocol (like udp or tcp)
11
- export type TransportResult = {
12
- result: 'reachable' | 'unreachable' | 'untested';
13
- latencyInMilliseconds?: number; // amount of time it took to get the first ICE candidate
14
- clientMediaIPs?: string[];
15
- };
16
-
17
- // reachability result for a specific media cluster
18
- export type ClusterReachabilityResult = {
19
- udp: TransportResult;
20
- tcp: TransportResult;
21
- xtls: TransportResult;
22
- };
9
+ import {ClusterReachabilityResult} from './reachability.types';
23
10
 
24
11
  // data for the Events.resultReady event
25
12
  export type ResultEventData = {
@@ -370,11 +357,14 @@ export class ClusterReachability extends EventsScope {
370
357
 
371
358
  this.startTimestamp = performance.now();
372
359
 
360
+ // Set up the state change listeners before triggering the ICE gathering
361
+ const gatherIceCandidatePromise = this.gatherIceCandidates();
362
+
373
363
  // not awaiting the next call on purpose, because we're not sending the offer anywhere and there won't be any answer
374
364
  // we just need to make this call to trigger the ICE gathering process
375
365
  this.pc.setLocalDescription(offer);
376
366
 
377
- await this.gatherIceCandidates();
367
+ await gatherIceCandidatePromise;
378
368
  } catch (error) {
379
369
  LoggerProxy.logger.warn(`Reachability:ClusterReachability#start --> Error: `, error);
380
370
  }