@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/cjs/index.js CHANGED
@@ -14925,6 +14925,7 @@ const defaultMultistreamConnectionOptions = {
14925
14925
  disableContentSimulcast: true,
14926
14926
  disableAudioTwcc: true,
14927
14927
  doFullIce: BrowserInfo.isFirefox(),
14928
+ stopIceGatheringAfterFirstRelayCandidate: false,
14928
14929
  metricsCallback: () => { },
14929
14930
  };
14930
14931
  class MultistreamConnection extends EventEmitter$2 {
@@ -14938,6 +14939,8 @@ class MultistreamConnection extends EventEmitter$2 {
14938
14939
  this.midPredictor = new MidPredictor();
14939
14940
  this.offerAnswerQueue = new AsyncQueue();
14940
14941
  this.currentCreateOfferId = 0;
14942
+ this.iceCandidates = [];
14943
+ this.metadata = { isMediaBypassEdge: false };
14941
14944
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
14942
14945
  logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
14943
14946
  this.metricsCallback = this.options.metricsCallback;
@@ -14989,6 +14992,9 @@ class MultistreamConnection extends EventEmitter$2 {
14989
14992
  this.emit(exports.MultistreamConnectionEventNames.IceGatheringStateUpdate, this.getIceGatheringState());
14990
14993
  });
14991
14994
  this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
14995
+ if (candidate.candidate) {
14996
+ this.iceCandidates.push(candidate.candidate);
14997
+ }
14992
14998
  this.emit(exports.MultistreamConnectionEventNames.IceCandidate, candidate);
14993
14999
  });
14994
15000
  this.pc.on(PeerConnection.Events.IceCandidateError, (error) => {
@@ -15425,6 +15431,13 @@ SCTP Max Message Size: ${maxMessageSize}`);
15425
15431
  resolve();
15426
15432
  }
15427
15433
  else {
15434
+ this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
15435
+ if (candidate.candidate === null ||
15436
+ (this.options.stopIceGatheringAfterFirstRelayCandidate &&
15437
+ candidate.candidate.type === 'relay')) {
15438
+ resolve();
15439
+ }
15440
+ });
15428
15441
  this.pc.on(PeerConnection.Events.IceGatheringStateChange, () => {
15429
15442
  if (this.pc.iceGatheringState === 'complete') {
15430
15443
  resolve();
@@ -15587,9 +15600,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
15587
15600
  });
15588
15601
  }
15589
15602
  if (BrowserInfo.isFirefox() && this.options.doFullIce) {
15590
- const { candidates } = parsedOffer.media[0].iceInfo;
15591
15603
  parsedOffer.media.forEach((media) => {
15592
- media.iceInfo.candidates = candidates;
15604
+ media.iceInfo.candidates = [];
15605
+ this.iceCandidates.forEach((iceCandidate) => {
15606
+ const candidateLine = CandidateLine.fromSdpLine(iceCandidate.candidate.toString());
15607
+ if (candidateLine) {
15608
+ media.addLine(candidateLine);
15609
+ }
15610
+ });
15593
15611
  });
15594
15612
  }
15595
15613
  if (BrowserInfo.isFirefox()) {
@@ -15606,7 +15624,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
15606
15624
  return parsedOffer.toString();
15607
15625
  }
15608
15626
  preProcessRemoteAnswer(answer) {
15609
- var _a;
15627
+ var _a, _b;
15610
15628
  const parsedAnswer = parse(answer);
15611
15629
  const parsedOffer = parse((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
15612
15630
  matchMediaDescriptionsInAnswer(parsedOffer, parsedAnswer);
@@ -15632,6 +15650,9 @@ SCTP Max Message Size: ${maxMessageSize}`);
15632
15650
  if (BrowserInfo.isFirefox()) {
15633
15651
  setupBundle(parsedAnswer, this.options.bundlePolicy, this.midPredictor.getMidMap());
15634
15652
  }
15653
+ if ((_b = parsedAnswer.session.information) === null || _b === void 0 ? void 0 : _b.info) {
15654
+ this.metadata.isMediaBypassEdge = !parsedAnswer.session.information.info.includes('linus');
15655
+ }
15635
15656
  return parsedAnswer.toString();
15636
15657
  }
15637
15658
  getSendTransceiverOrThrow(mediaType) {
@@ -15756,6 +15777,11 @@ SCTP Max Message Size: ${maxMessageSize}`);
15756
15777
  }
15757
15778
  preProcessStats(stats) {
15758
15779
  return __awaiter$1(this, void 0, void 0, function* () {
15780
+ stats.forEach((stat) => {
15781
+ if (stat.type === 'peer-connection') {
15782
+ stat.isMediaBypassEdge = this.metadata.isMediaBypassEdge;
15783
+ }
15784
+ });
15759
15785
  yield Promise.all([...this.sendTransceivers.values()].map((transceiver) => __awaiter$1(this, void 0, void 0, function* () {
15760
15786
  (yield transceiver.getStats()).forEach((senderStats) => {
15761
15787
  if (senderStats.type === 'outbound-rtp' || senderStats.type === 'media-source') {