@webex/plugin-meetings 3.0.0-beta.269 → 3.0.0-beta.270

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.
@@ -209,7 +209,7 @@ var Breakout = _webexCore.WebexPlugin.extend({
209
209
  sessionId: this.sessionId
210
210
  });
211
211
  },
212
- version: "3.0.0-beta.269"
212
+ version: "3.0.0-beta.270"
213
213
  });
214
214
  var _default = Breakout;
215
215
  exports.default = _default;
@@ -1041,7 +1041,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
1041
1041
  this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
1042
1042
  }
1043
1043
  },
1044
- version: "3.0.0-beta.269"
1044
+ version: "3.0.0-beta.270"
1045
1045
  });
1046
1046
  var _default = Breakouts;
1047
1047
  exports.default = _default;
@@ -359,7 +359,7 @@ var SimultaneousInterpretation = _webexCore.WebexPlugin.extend({
359
359
  throw error;
360
360
  });
361
361
  },
362
- version: "3.0.0-beta.269"
362
+ version: "3.0.0-beta.270"
363
363
  });
364
364
  var _default = SimultaneousInterpretation;
365
365
  exports.default = _default;
@@ -18,7 +18,7 @@ var SILanguage = _webexCore.WebexPlugin.extend({
18
18
  languageCode: 'number',
19
19
  languageName: 'string'
20
20
  },
21
- version: "3.0.0-beta.269"
21
+ version: "3.0.0-beta.270"
22
22
  });
23
23
  var _default = SILanguage;
24
24
  exports.default = _default;
@@ -8,6 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
10
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
11
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
12
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
13
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -231,7 +232,7 @@ var MediaProperties = /*#__PURE__*/function () {
231
232
  key: "getCurrentConnectionType",
232
233
  value: function () {
233
234
  var _getCurrentConnectionType = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
234
- var allStatsReports, statsResult, successfulCandidatePairs, foundConnectionType;
235
+ var allStatsReports, statsResult, successfulCandidatePairs, foundConnectionType, candidatePairStates;
235
236
  return _regenerator.default.wrap(function _callee$(_context) {
236
237
  while (1) switch (_context.prev = _context.next) {
237
238
  case 0:
@@ -279,10 +280,19 @@ var MediaProperties = /*#__PURE__*/function () {
279
280
  foundConnectionType = connectionType;
280
281
  return true;
281
282
  }
283
+ _loggerProxy.default.logger.warn("Media:properties#getCurrentConnectionType --> missing localCandidate.protocol, candidateType=".concat(localCandidate.candidateType));
282
284
  return false;
283
285
  });
286
+ if (foundConnectionType === 'unknown') {
287
+ candidatePairStates = allStatsReports.filter(function (report) {
288
+ return report.type === 'candidate-pair';
289
+ }).map(function (report) {
290
+ return report.state;
291
+ });
292
+ _loggerProxy.default.logger.warn("Media:properties#getCurrentConnectionType --> all candidate pair states: ".concat((0, _stringify.default)(candidatePairStates)));
293
+ }
284
294
  return _context.abrupt("return", foundConnectionType);
285
- case 17:
295
+ case 18:
286
296
  case "end":
287
297
  return _context.stop();
288
298
  }
@@ -1 +1 @@
1
- {"version":3,"names":["MediaProperties","MEETINGS","webrtcMediaConnection","mediaDirection","receiveAudio","receiveVideo","receiveShare","sendAudio","sendVideo","sendShare","videoStream","audioStream","shareVideoStream","shareAudioStream","remoteShareStream","undefined","remoteAudioStream","remoteVideoStream","remoteQualityLevel","QUALITY_LEVELS","HIGH","mediaSettings","videoDeviceId","type","values","mediaPeerConnection","deviceId","unsetRemoteMedia","unsetRemoteShareStream","isConnected","getConnectionState","ConnectionState","Connected","resolve","reject","timer","connectionStateListener","LoggerProxy","logger","log","clearTimeout","off","Event","CONNECTION_STATE_CHANGED","setTimeout","PC_BAIL_TIMEOUT","on","waitForMediaConnectionConnected","allStatsReports","getStats","statsResult","forEach","report","push","warn","successfulCandidatePairs","filter","state","toLowerCase","foundConnectionType","some","pair","localCandidate","find","id","localCandidateId","connectionType","relayProtocol","toUpperCase","protocol"],"sources":["properties.ts"],"sourcesContent":["import {ConnectionState, Event} from '@webex/internal-media-core';\n\nimport {\n LocalCameraStream,\n LocalMicrophoneStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n RemoteStream,\n} from '@webex/media-helpers';\n\nimport {MEETINGS, PC_BAIL_TIMEOUT, QUALITY_LEVELS} from '../constants';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nexport type MediaDirection = {\n sendAudio: boolean;\n sendVideo: boolean;\n sendShare: boolean;\n receiveAudio: boolean;\n receiveVideo: boolean;\n receiveShare: boolean;\n};\n\n/**\n * @class MediaProperties\n */\nexport default class MediaProperties {\n audioStream?: LocalMicrophoneStream;\n mediaDirection: MediaDirection;\n mediaSettings: any;\n webrtcMediaConnection: any;\n remoteAudioStream: RemoteStream;\n remoteQualityLevel: any;\n remoteShareStream: RemoteStream;\n remoteVideoStream: RemoteStream;\n shareVideoStream?: LocalDisplayStream;\n shareAudioStream?: LocalSystemAudioStream;\n videoDeviceId: any;\n videoStream?: LocalCameraStream;\n namespace = MEETINGS;\n\n /**\n * @param {Object} [options] -- to auto construct\n * @returns {MediaProperties}\n */\n constructor() {\n this.webrtcMediaConnection = null;\n this.mediaDirection = {\n receiveAudio: false,\n receiveVideo: false,\n receiveShare: false,\n sendAudio: false,\n sendVideo: false,\n sendShare: false,\n };\n this.videoStream = null;\n this.audioStream = null;\n this.shareVideoStream = null;\n this.shareAudioStream = null;\n this.remoteShareStream = undefined;\n this.remoteAudioStream = undefined;\n this.remoteVideoStream = undefined;\n this.remoteQualityLevel = QUALITY_LEVELS.HIGH;\n this.mediaSettings = {};\n this.videoDeviceId = null;\n }\n\n /**\n * Retrieves the preferred video input device\n * @returns {Object|null}\n */\n getVideoDeviceId() {\n return this.videoDeviceId || null;\n }\n\n setMediaDirection(mediaDirection) {\n this.mediaDirection = mediaDirection;\n }\n\n setMediaSettings(type, values) {\n this.mediaSettings[type] = values;\n }\n\n setMediaPeerConnection(mediaPeerConnection) {\n this.webrtcMediaConnection = mediaPeerConnection;\n }\n\n setLocalVideoStream(videoStream?: LocalCameraStream) {\n this.videoStream = videoStream;\n }\n\n setLocalAudioStream(audioStream?: LocalMicrophoneStream) {\n this.audioStream = audioStream;\n }\n\n setLocalShareVideoStream(shareVideoStream?: LocalDisplayStream) {\n this.shareVideoStream = shareVideoStream;\n }\n\n setLocalShareAudioStream(shareAudioStream?: LocalSystemAudioStream) {\n this.shareAudioStream = shareAudioStream;\n }\n\n setRemoteQualityLevel(remoteQualityLevel) {\n this.remoteQualityLevel = remoteQualityLevel;\n }\n\n setRemoteShareStream(remoteShareStream: RemoteStream) {\n this.remoteShareStream = remoteShareStream;\n }\n\n /**\n * Sets the remote audio stream\n * @param {RemoteStream} remoteAudioStream RemoteStream to save\n * @returns {void}\n */\n setRemoteAudioStream(remoteAudioStream: RemoteStream) {\n this.remoteAudioStream = remoteAudioStream;\n }\n\n /**\n * Sets the remote video stream\n * @param {RemoteStream} remoteVideoStream RemoteStream to save\n * @returns {void}\n */\n setRemoteVideoStream(remoteVideoStream: RemoteStream) {\n this.remoteVideoStream = remoteVideoStream;\n }\n\n /**\n * Stores the preferred video input device\n * @param {string} deviceId Preferred video input device\n * @returns {void}\n */\n setVideoDeviceId(deviceId: string) {\n this.videoDeviceId = deviceId;\n }\n\n unsetPeerConnection() {\n this.webrtcMediaConnection = null;\n }\n\n /**\n * Removes both remote audio and video from class instance\n * @returns {void}\n */\n unsetRemoteMedia() {\n this.remoteAudioStream = null;\n this.remoteVideoStream = null;\n }\n\n unsetRemoteShareStream() {\n this.remoteShareStream = null;\n }\n\n /**\n * Unsets all remote streams\n * @returns {void}\n */\n unsetRemoteStreams() {\n this.unsetRemoteMedia();\n this.unsetRemoteShareStream();\n }\n\n /**\n * Returns if we have at least one local share stream or not.\n * @returns {Boolean}\n */\n hasLocalShareStream() {\n return !!(this.shareAudioStream || this.shareVideoStream);\n }\n\n /**\n * Waits for the webrtc media connection to be connected.\n *\n * @returns {Promise<void>}\n */\n waitForMediaConnectionConnected(): Promise<void> {\n const isConnected = () =>\n this.webrtcMediaConnection.getConnectionState() === ConnectionState.Connected;\n\n if (isConnected()) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve, reject) => {\n let timer;\n\n const connectionStateListener = () => {\n LoggerProxy.logger.log(\n `Media:properties#waitForMediaConnectionConnected --> connection state: ${this.webrtcMediaConnection.getConnectionState()}`\n );\n\n if (isConnected()) {\n clearTimeout(timer);\n this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, connectionStateListener);\n resolve();\n }\n };\n\n timer = setTimeout(() => {\n this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, connectionStateListener);\n reject();\n }, PC_BAIL_TIMEOUT);\n\n this.webrtcMediaConnection.on(Event.CONNECTION_STATE_CHANGED, connectionStateListener);\n });\n }\n\n /**\n * Returns the type of a connection that has been established\n *\n * @returns {Promise<'UDP' | 'TCP' | 'TURN-TLS' | 'TURN-TCP' | 'TURN-UDP' | 'unknown'>}\n */\n async getCurrentConnectionType() {\n // we can only get the connection type after ICE connection has been established\n await this.waitForMediaConnectionConnected();\n\n const allStatsReports = [];\n\n try {\n const statsResult = await this.webrtcMediaConnection.getStats();\n statsResult.forEach((report) => allStatsReports.push(report));\n } catch (error) {\n LoggerProxy.logger.warn(\n `Media:properties#getCurrentConnectionType --> getStats() failed: ${error}`\n );\n }\n\n const successfulCandidatePairs = allStatsReports.filter(\n (report) => report.type === 'candidate-pair' && report.state?.toLowerCase() === 'succeeded'\n );\n\n let foundConnectionType = 'unknown';\n\n // all of the successful pairs should have the same connection type, so just return the type for the first one\n successfulCandidatePairs.some((pair) => {\n const localCandidate = allStatsReports.find(\n (report) => report.type === 'local-candidate' && report.id === pair.localCandidateId\n );\n\n if (localCandidate === undefined) {\n LoggerProxy.logger.warn(\n `Media:properties#getCurrentConnectionType --> failed to find local candidate \"${pair.localCandidateId}\" in getStats() results`\n );\n\n return false;\n }\n\n let connectionType;\n\n if (localCandidate.relayProtocol) {\n connectionType = `TURN-${localCandidate.relayProtocol.toUpperCase()}`;\n } else {\n connectionType = localCandidate.protocol?.toUpperCase(); // it will be UDP or TCP\n }\n\n if (connectionType) {\n foundConnectionType = connectionType;\n\n return true;\n }\n\n return false;\n });\n\n return foundConnectionType;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAUA;AACA;AAWA;AACA;AACA;AAFA,IAGqBA,eAAe;EAelC;AACF;AACA;AACA;EACE,2BAAc;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,iDANFC,mBAAQ;IAOlB,IAAI,CAACC,qBAAqB,GAAG,IAAI;IACjC,IAAI,CAACC,cAAc,GAAG;MACpBC,YAAY,EAAE,KAAK;MACnBC,YAAY,EAAE,KAAK;MACnBC,YAAY,EAAE,KAAK;MACnBC,SAAS,EAAE,KAAK;MAChBC,SAAS,EAAE,KAAK;MAChBC,SAAS,EAAE;IACb,CAAC;IACD,IAAI,CAACC,WAAW,GAAG,IAAI;IACvB,IAAI,CAACC,WAAW,GAAG,IAAI;IACvB,IAAI,CAACC,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACC,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACC,iBAAiB,GAAGC,SAAS;IAClC,IAAI,CAACC,iBAAiB,GAAGD,SAAS;IAClC,IAAI,CAACE,iBAAiB,GAAGF,SAAS;IAClC,IAAI,CAACG,kBAAkB,GAAGC,yBAAc,CAACC,IAAI;IAC7C,IAAI,CAACC,aAAa,GAAG,CAAC,CAAC;IACvB,IAAI,CAACC,aAAa,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,OAAKA,MAAM,CAAC7B,IAAI,KAAK,iBAAiB,IAAI6B,MAAM,CAACY,EAAE,KAAKH,IAAI,CAACI,gBAAgB;gBAAA,EACrF;gBAED,IAAIH,cAAc,KAAK/C,SAAS,EAAE;kBAChCsB,oBAAW,CAACC,MAAM,CAACgB,IAAI,0FAC4DO,IAAI,CAACI,gBAAgB,8BACvG;kBAED,OAAO,KAAK;gBACd;gBAEA,IAAIC,cAAc;gBAElB,IAAIJ,cAAc,CAACK,aAAa,EAAE;kBAChCD,cAAc,kBAAWJ,cAAc,CAACK,aAAa,CAACC,WAAW,EAAE,CAAE;gBACvE,CAAC,MAAM;kBAAA;kBACLF,cAAc,4BAAGJ,cAAc,CAACO,QAAQ,0DAAvB,sBAAyBD,WAAW,EAAE,CAAC,CAAC;gBAC3D;;gBAEA,IAAIF,cAAc,EAAE;kBAClBP,mBAAmB,GAAGO,cAAc;kBAEpC,OAAO,IAAI;gBACb;gBAEA,OAAO,KAAK;cACd,CAAC,CAAC;cAAC,iCAEIP,mBAAmB;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CAC3B;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA;AAAA"}
1
+ {"version":3,"names":["MediaProperties","MEETINGS","webrtcMediaConnection","mediaDirection","receiveAudio","receiveVideo","receiveShare","sendAudio","sendVideo","sendShare","videoStream","audioStream","shareVideoStream","shareAudioStream","remoteShareStream","undefined","remoteAudioStream","remoteVideoStream","remoteQualityLevel","QUALITY_LEVELS","HIGH","mediaSettings","videoDeviceId","type","values","mediaPeerConnection","deviceId","unsetRemoteMedia","unsetRemoteShareStream","isConnected","getConnectionState","ConnectionState","Connected","resolve","reject","timer","connectionStateListener","LoggerProxy","logger","log","clearTimeout","off","Event","CONNECTION_STATE_CHANGED","setTimeout","PC_BAIL_TIMEOUT","on","waitForMediaConnectionConnected","allStatsReports","getStats","statsResult","forEach","report","push","warn","successfulCandidatePairs","filter","state","toLowerCase","foundConnectionType","some","pair","localCandidate","find","id","localCandidateId","connectionType","relayProtocol","toUpperCase","protocol","candidateType","candidatePairStates","map"],"sources":["properties.ts"],"sourcesContent":["import {ConnectionState, Event} from '@webex/internal-media-core';\n\nimport {\n LocalCameraStream,\n LocalMicrophoneStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n RemoteStream,\n} from '@webex/media-helpers';\n\nimport {MEETINGS, PC_BAIL_TIMEOUT, QUALITY_LEVELS} from '../constants';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nexport type MediaDirection = {\n sendAudio: boolean;\n sendVideo: boolean;\n sendShare: boolean;\n receiveAudio: boolean;\n receiveVideo: boolean;\n receiveShare: boolean;\n};\n\n/**\n * @class MediaProperties\n */\nexport default class MediaProperties {\n audioStream?: LocalMicrophoneStream;\n mediaDirection: MediaDirection;\n mediaSettings: any;\n webrtcMediaConnection: any;\n remoteAudioStream: RemoteStream;\n remoteQualityLevel: any;\n remoteShareStream: RemoteStream;\n remoteVideoStream: RemoteStream;\n shareVideoStream?: LocalDisplayStream;\n shareAudioStream?: LocalSystemAudioStream;\n videoDeviceId: any;\n videoStream?: LocalCameraStream;\n namespace = MEETINGS;\n\n /**\n * @param {Object} [options] -- to auto construct\n * @returns {MediaProperties}\n */\n constructor() {\n this.webrtcMediaConnection = null;\n this.mediaDirection = {\n receiveAudio: false,\n receiveVideo: false,\n receiveShare: false,\n sendAudio: false,\n sendVideo: false,\n sendShare: false,\n };\n this.videoStream = null;\n this.audioStream = null;\n this.shareVideoStream = null;\n this.shareAudioStream = null;\n this.remoteShareStream = undefined;\n this.remoteAudioStream = undefined;\n this.remoteVideoStream = undefined;\n this.remoteQualityLevel = QUALITY_LEVELS.HIGH;\n this.mediaSettings = {};\n this.videoDeviceId = null;\n }\n\n /**\n * Retrieves the preferred video input device\n * @returns {Object|null}\n */\n getVideoDeviceId() {\n return this.videoDeviceId || null;\n }\n\n setMediaDirection(mediaDirection) {\n this.mediaDirection = mediaDirection;\n }\n\n setMediaSettings(type, values) {\n this.mediaSettings[type] = values;\n }\n\n setMediaPeerConnection(mediaPeerConnection) {\n this.webrtcMediaConnection = mediaPeerConnection;\n }\n\n setLocalVideoStream(videoStream?: LocalCameraStream) {\n this.videoStream = videoStream;\n }\n\n setLocalAudioStream(audioStream?: LocalMicrophoneStream) {\n this.audioStream = audioStream;\n }\n\n setLocalShareVideoStream(shareVideoStream?: LocalDisplayStream) {\n this.shareVideoStream = shareVideoStream;\n }\n\n setLocalShareAudioStream(shareAudioStream?: LocalSystemAudioStream) {\n this.shareAudioStream = shareAudioStream;\n }\n\n setRemoteQualityLevel(remoteQualityLevel) {\n this.remoteQualityLevel = remoteQualityLevel;\n }\n\n setRemoteShareStream(remoteShareStream: RemoteStream) {\n this.remoteShareStream = remoteShareStream;\n }\n\n /**\n * Sets the remote audio stream\n * @param {RemoteStream} remoteAudioStream RemoteStream to save\n * @returns {void}\n */\n setRemoteAudioStream(remoteAudioStream: RemoteStream) {\n this.remoteAudioStream = remoteAudioStream;\n }\n\n /**\n * Sets the remote video stream\n * @param {RemoteStream} remoteVideoStream RemoteStream to save\n * @returns {void}\n */\n setRemoteVideoStream(remoteVideoStream: RemoteStream) {\n this.remoteVideoStream = remoteVideoStream;\n }\n\n /**\n * Stores the preferred video input device\n * @param {string} deviceId Preferred video input device\n * @returns {void}\n */\n setVideoDeviceId(deviceId: string) {\n this.videoDeviceId = deviceId;\n }\n\n unsetPeerConnection() {\n this.webrtcMediaConnection = null;\n }\n\n /**\n * Removes both remote audio and video from class instance\n * @returns {void}\n */\n unsetRemoteMedia() {\n this.remoteAudioStream = null;\n this.remoteVideoStream = null;\n }\n\n unsetRemoteShareStream() {\n this.remoteShareStream = null;\n }\n\n /**\n * Unsets all remote streams\n * @returns {void}\n */\n unsetRemoteStreams() {\n this.unsetRemoteMedia();\n this.unsetRemoteShareStream();\n }\n\n /**\n * Returns if we have at least one local share stream or not.\n * @returns {Boolean}\n */\n hasLocalShareStream() {\n return !!(this.shareAudioStream || this.shareVideoStream);\n }\n\n /**\n * Waits for the webrtc media connection to be connected.\n *\n * @returns {Promise<void>}\n */\n waitForMediaConnectionConnected(): Promise<void> {\n const isConnected = () =>\n this.webrtcMediaConnection.getConnectionState() === ConnectionState.Connected;\n\n if (isConnected()) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve, reject) => {\n let timer;\n\n const connectionStateListener = () => {\n LoggerProxy.logger.log(\n `Media:properties#waitForMediaConnectionConnected --> connection state: ${this.webrtcMediaConnection.getConnectionState()}`\n );\n\n if (isConnected()) {\n clearTimeout(timer);\n this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, connectionStateListener);\n resolve();\n }\n };\n\n timer = setTimeout(() => {\n this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, connectionStateListener);\n reject();\n }, PC_BAIL_TIMEOUT);\n\n this.webrtcMediaConnection.on(Event.CONNECTION_STATE_CHANGED, connectionStateListener);\n });\n }\n\n /**\n * Returns the type of a connection that has been established\n *\n * @returns {Promise<'UDP' | 'TCP' | 'TURN-TLS' | 'TURN-TCP' | 'TURN-UDP' | 'unknown'>}\n */\n async getCurrentConnectionType() {\n // we can only get the connection type after ICE connection has been established\n await this.waitForMediaConnectionConnected();\n\n const allStatsReports = [];\n\n try {\n const statsResult = await this.webrtcMediaConnection.getStats();\n statsResult.forEach((report) => allStatsReports.push(report));\n } catch (error) {\n LoggerProxy.logger.warn(\n `Media:properties#getCurrentConnectionType --> getStats() failed: ${error}`\n );\n }\n\n const successfulCandidatePairs = allStatsReports.filter(\n (report) => report.type === 'candidate-pair' && report.state?.toLowerCase() === 'succeeded'\n );\n\n let foundConnectionType = 'unknown';\n\n // all of the successful pairs should have the same connection type, so just return the type for the first one\n successfulCandidatePairs.some((pair) => {\n const localCandidate = allStatsReports.find(\n (report) => report.type === 'local-candidate' && report.id === pair.localCandidateId\n );\n\n if (localCandidate === undefined) {\n LoggerProxy.logger.warn(\n `Media:properties#getCurrentConnectionType --> failed to find local candidate \"${pair.localCandidateId}\" in getStats() results`\n );\n\n return false;\n }\n\n let connectionType;\n\n if (localCandidate.relayProtocol) {\n connectionType = `TURN-${localCandidate.relayProtocol.toUpperCase()}`;\n } else {\n connectionType = localCandidate.protocol?.toUpperCase(); // it will be UDP or TCP\n }\n\n if (connectionType) {\n foundConnectionType = connectionType;\n\n return true;\n }\n LoggerProxy.logger.warn(\n `Media:properties#getCurrentConnectionType --> missing localCandidate.protocol, candidateType=${localCandidate.candidateType}`\n );\n\n return false;\n });\n\n if (foundConnectionType === 'unknown') {\n const candidatePairStates = allStatsReports\n .filter((report) => report.type === 'candidate-pair')\n .map((report) => report.state);\n\n LoggerProxy.logger.warn(\n `Media:properties#getCurrentConnectionType --> all candidate pair states: ${JSON.stringify(\n candidatePairStates\n )}`\n );\n }\n\n return foundConnectionType;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAUA;AACA;AAWA;AACA;AACA;AAFA,IAGqBA,eAAe;EAelC;AACF;AACA;AACA;EACE,2BAAc;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,iDANFC,mBAAQ;IAOlB,IAAI,CAACC,qBAAqB,GAAG,IAAI;IACjC,IAAI,CAACC,cAAc,GAAG;MACpBC,YAAY,EAAE,KAAK;MACnBC,YAAY,EAAE,KAAK;MACnBC,YAAY,EAAE,KAAK;MACnBC,SAAS,EAAE,KAAK;MAChBC,SAAS,EAAE,KAAK;MAChBC,SAAS,EAAE;IACb,CAAC;IACD,IAAI,CAACC,WAAW,GAAG,IAAI;IACvB,IAAI,CAACC,WAAW,GAAG,IAAI;IACvB,IAAI,CAACC,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACC,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACC,iBAAiB,GAAGC,SAAS;IAClC,IAAI,CAACC,iBAAiB,GAAGD,SAAS;IAClC,IAAI,CAACE,iBAAiB,GAAGF,SAAS;IAClC,IAAI,C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A;EAAA;EAAA;AAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-beta.269",
3
+ "version": "3.0.0-beta.270",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "contributors": [
@@ -32,12 +32,12 @@
32
32
  "build": "yarn run -T tsc --declaration true --declarationDir ./dist/types"
33
33
  },
34
34
  "devDependencies": {
35
- "@webex/plugin-meetings": "3.0.0-beta.269",
36
- "@webex/test-helper-chai": "3.0.0-beta.269",
37
- "@webex/test-helper-mocha": "3.0.0-beta.269",
38
- "@webex/test-helper-mock-webex": "3.0.0-beta.269",
39
- "@webex/test-helper-retry": "3.0.0-beta.269",
40
- "@webex/test-helper-test-users": "3.0.0-beta.269",
35
+ "@webex/plugin-meetings": "3.0.0-beta.270",
36
+ "@webex/test-helper-chai": "3.0.0-beta.270",
37
+ "@webex/test-helper-mocha": "3.0.0-beta.270",
38
+ "@webex/test-helper-mock-webex": "3.0.0-beta.270",
39
+ "@webex/test-helper-retry": "3.0.0-beta.270",
40
+ "@webex/test-helper-test-users": "3.0.0-beta.270",
41
41
  "chai": "^4.3.4",
42
42
  "chai-as-promised": "^7.1.1",
43
43
  "jsdom-global": "3.0.2",
@@ -46,19 +46,19 @@
46
46
  "typescript": "^4.7.4"
47
47
  },
48
48
  "dependencies": {
49
- "@webex/common": "3.0.0-beta.269",
49
+ "@webex/common": "3.0.0-beta.270",
50
50
  "@webex/internal-media-core": "2.0.4",
51
- "@webex/internal-plugin-conversation": "3.0.0-beta.269",
52
- "@webex/internal-plugin-device": "3.0.0-beta.269",
53
- "@webex/internal-plugin-llm": "3.0.0-beta.269",
54
- "@webex/internal-plugin-mercury": "3.0.0-beta.269",
55
- "@webex/internal-plugin-metrics": "3.0.0-beta.269",
56
- "@webex/internal-plugin-support": "3.0.0-beta.269",
57
- "@webex/internal-plugin-user": "3.0.0-beta.269",
58
- "@webex/media-helpers": "3.0.0-beta.269",
59
- "@webex/plugin-people": "3.0.0-beta.269",
60
- "@webex/plugin-rooms": "3.0.0-beta.269",
61
- "@webex/webex-core": "3.0.0-beta.269",
51
+ "@webex/internal-plugin-conversation": "3.0.0-beta.270",
52
+ "@webex/internal-plugin-device": "3.0.0-beta.270",
53
+ "@webex/internal-plugin-llm": "3.0.0-beta.270",
54
+ "@webex/internal-plugin-mercury": "3.0.0-beta.270",
55
+ "@webex/internal-plugin-metrics": "3.0.0-beta.270",
56
+ "@webex/internal-plugin-support": "3.0.0-beta.270",
57
+ "@webex/internal-plugin-user": "3.0.0-beta.270",
58
+ "@webex/media-helpers": "3.0.0-beta.270",
59
+ "@webex/plugin-people": "3.0.0-beta.270",
60
+ "@webex/plugin-rooms": "3.0.0-beta.270",
61
+ "@webex/webex-core": "3.0.0-beta.270",
62
62
  "ampersand-collection": "^2.0.2",
63
63
  "bowser": "^2.11.0",
64
64
  "btoa": "^1.2.1",
@@ -259,10 +259,25 @@ export default class MediaProperties {
259
259
 
260
260
  return true;
261
261
  }
262
+ LoggerProxy.logger.warn(
263
+ `Media:properties#getCurrentConnectionType --> missing localCandidate.protocol, candidateType=${localCandidate.candidateType}`
264
+ );
262
265
 
263
266
  return false;
264
267
  });
265
268
 
269
+ if (foundConnectionType === 'unknown') {
270
+ const candidatePairStates = allStatsReports
271
+ .filter((report) => report.type === 'candidate-pair')
272
+ .map((report) => report.state);
273
+
274
+ LoggerProxy.logger.warn(
275
+ `Media:properties#getCurrentConnectionType --> all candidate pair states: ${JSON.stringify(
276
+ candidatePairStates
277
+ )}`
278
+ );
279
+ }
280
+
266
281
  return foundConnectionType;
267
282
  }
268
283
  }