@webex/web-client-media-engine 3.30.2 → 3.30.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -14921,6 +14921,7 @@ const defaultMultistreamConnectionOptions = {
14921
14921
  disableContentSimulcast: true,
14922
14922
  disableAudioTwcc: true,
14923
14923
  doFullIce: BrowserInfo.isFirefox(),
14924
+ stopIceGatheringAfterFirstRelayCandidate: false,
14924
14925
  metricsCallback: () => { },
14925
14926
  };
14926
14927
  class MultistreamConnection extends EventEmitter$2 {
@@ -14934,6 +14935,8 @@ class MultistreamConnection extends EventEmitter$2 {
14934
14935
  this.midPredictor = new MidPredictor();
14935
14936
  this.offerAnswerQueue = new AsyncQueue();
14936
14937
  this.currentCreateOfferId = 0;
14938
+ this.iceCandidates = [];
14939
+ this.metadata = { isMediaBypassEdge: false };
14937
14940
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
14938
14941
  logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
14939
14942
  this.metricsCallback = this.options.metricsCallback;
@@ -14985,6 +14988,9 @@ class MultistreamConnection extends EventEmitter$2 {
14985
14988
  this.emit(MultistreamConnectionEventNames.IceGatheringStateUpdate, this.getIceGatheringState());
14986
14989
  });
14987
14990
  this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
14991
+ if (candidate.candidate) {
14992
+ this.iceCandidates.push(candidate.candidate);
14993
+ }
14988
14994
  this.emit(MultistreamConnectionEventNames.IceCandidate, candidate);
14989
14995
  });
14990
14996
  this.pc.on(PeerConnection.Events.IceCandidateError, (error) => {
@@ -15421,6 +15427,13 @@ SCTP Max Message Size: ${maxMessageSize}`);
15421
15427
  resolve();
15422
15428
  }
15423
15429
  else {
15430
+ this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
15431
+ if (candidate.candidate === null ||
15432
+ (this.options.stopIceGatheringAfterFirstRelayCandidate &&
15433
+ candidate.candidate.type === 'relay')) {
15434
+ resolve();
15435
+ }
15436
+ });
15424
15437
  this.pc.on(PeerConnection.Events.IceGatheringStateChange, () => {
15425
15438
  if (this.pc.iceGatheringState === 'complete') {
15426
15439
  resolve();
@@ -15583,9 +15596,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
15583
15596
  });
15584
15597
  }
15585
15598
  if (BrowserInfo.isFirefox() && this.options.doFullIce) {
15586
- const { candidates } = parsedOffer.media[0].iceInfo;
15587
15599
  parsedOffer.media.forEach((media) => {
15588
- media.iceInfo.candidates = candidates;
15600
+ media.iceInfo.candidates = [];
15601
+ this.iceCandidates.forEach((iceCandidate) => {
15602
+ const candidateLine = CandidateLine.fromSdpLine(iceCandidate.candidate.toString());
15603
+ if (candidateLine) {
15604
+ media.addLine(candidateLine);
15605
+ }
15606
+ });
15589
15607
  });
15590
15608
  }
15591
15609
  if (BrowserInfo.isFirefox()) {
@@ -15602,7 +15620,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
15602
15620
  return parsedOffer.toString();
15603
15621
  }
15604
15622
  preProcessRemoteAnswer(answer) {
15605
- var _a;
15623
+ var _a, _b;
15606
15624
  const parsedAnswer = parse(answer);
15607
15625
  const parsedOffer = parse((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
15608
15626
  matchMediaDescriptionsInAnswer(parsedOffer, parsedAnswer);
@@ -15628,6 +15646,9 @@ SCTP Max Message Size: ${maxMessageSize}`);
15628
15646
  if (BrowserInfo.isFirefox()) {
15629
15647
  setupBundle(parsedAnswer, this.options.bundlePolicy, this.midPredictor.getMidMap());
15630
15648
  }
15649
+ if ((_b = parsedAnswer.session.information) === null || _b === void 0 ? void 0 : _b.info) {
15650
+ this.metadata.isMediaBypassEdge = !parsedAnswer.session.information.info.includes('linus');
15651
+ }
15631
15652
  return parsedAnswer.toString();
15632
15653
  }
15633
15654
  getSendTransceiverOrThrow(mediaType) {
@@ -15752,6 +15773,11 @@ SCTP Max Message Size: ${maxMessageSize}`);
15752
15773
  }
15753
15774
  preProcessStats(stats) {
15754
15775
  return __awaiter$1(this, void 0, void 0, function* () {
15776
+ stats.forEach((stat) => {
15777
+ if (stat.type === 'peer-connection') {
15778
+ stat.isMediaBypassEdge = this.metadata.isMediaBypassEdge;
15779
+ }
15780
+ });
15755
15781
  yield Promise.all([...this.sendTransceivers.values()].map((transceiver) => __awaiter$1(this, void 0, void 0, function* () {
15756
15782
  (yield transceiver.getStats()).forEach((senderStats) => {
15757
15783
  if (senderStats.type === 'outbound-rtp' || senderStats.type === 'media-source') {