@webex/web-client-media-engine 3.31.0 → 3.31.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.
package/dist/esm/index.js CHANGED
@@ -7203,6 +7203,7 @@ var WcmeErrorType;
7203
7203
  WcmeErrorType["GET_PAYLOAD_TYPE_FAILED"] = "GET_PAYLOAD_TYPE_FAILED";
7204
7204
  WcmeErrorType["SET_NMG_FAILED"] = "SET_NMG_FAILED";
7205
7205
  WcmeErrorType["DATA_CHANNEL_SEND_FAILED"] = "DATA_CHANNEL_SEND_FAILED";
7206
+ WcmeErrorType["RENEW_PEER_CONNECTION_FAILED"] = "RENEW_PEER_CONNECTION_FAILED";
7206
7207
  })(WcmeErrorType || (WcmeErrorType = {}));
7207
7208
  class WcmeError {
7208
7209
  constructor(type, message = '') {
@@ -14963,8 +14964,6 @@ class MultistreamConnection extends EventEmitter$2 {
14963
14964
  this.createSendTransceiver(MediaType.AudioSlides, slidesSceneId);
14964
14965
  }
14965
14966
  initializePeerConnection() {
14966
- var _a;
14967
- (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
14968
14967
  this.pc = new PeerConnection({
14969
14968
  iceServers: this.options.iceServers,
14970
14969
  bundlePolicy: this.options.bundlePolicy,
@@ -15728,38 +15727,47 @@ SCTP Max Message Size: ${maxMessageSize}`);
15728
15727
  }
15729
15728
  }
15730
15729
  renewPeerConnection(userOptions) {
15731
- if (userOptions) {
15732
- this.options = Object.assign(Object.assign({}, this.options), userOptions);
15733
- }
15734
- logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
15735
- this.midPredictor.reset();
15736
- this.initializePeerConnection();
15737
- const mainSceneId = generateSceneId();
15738
- const slidesSceneId = generateSceneId();
15739
- this.sendTransceivers.forEach((transceiver, mediaType) => {
15740
- var _a;
15741
- const mediaContent = getMediaContent(mediaType);
15742
- const sceneId = mediaContent === MediaContent.Main ? mainSceneId : slidesSceneId;
15743
- const mid = this.midPredictor.getNextMid(mediaType);
15744
- transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15745
- direction: 'sendrecv',
15746
- sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
15747
- ? this.getVideoEncodingOptions(mediaContent)
15748
- : undefined,
15749
- }));
15750
- transceiver.mid = mid;
15751
- transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
15752
- transceiver.resetSdpMunger();
15753
- (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
15754
- this.createJmpSession(mediaType);
15755
- });
15756
- this.recvTransceivers.forEach((transceivers, mediaType) => {
15757
- transceivers.forEach((t) => {
15730
+ var _a;
15731
+ return __awaiter$1(this, void 0, void 0, function* () {
15732
+ (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
15733
+ try {
15734
+ if (userOptions) {
15735
+ this.options = Object.assign(Object.assign({}, this.options), (yield userOptions));
15736
+ }
15737
+ }
15738
+ catch (error) {
15739
+ logErrorAndThrow(WcmeErrorType.RENEW_PEER_CONNECTION_FAILED, `Error while awaiting user options: ${error}`);
15740
+ }
15741
+ logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
15742
+ this.midPredictor.reset();
15743
+ this.initializePeerConnection();
15744
+ const mainSceneId = generateSceneId();
15745
+ const slidesSceneId = generateSceneId();
15746
+ this.sendTransceivers.forEach((transceiver, mediaType) => {
15747
+ var _a;
15748
+ const mediaContent = getMediaContent(mediaType);
15749
+ const sceneId = mediaContent === MediaContent.Main ? mainSceneId : slidesSceneId;
15758
15750
  const mid = this.midPredictor.getNextMid(mediaType);
15759
- t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15760
- direction: 'recvonly',
15751
+ transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15752
+ direction: 'sendrecv',
15753
+ sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
15754
+ ? this.getVideoEncodingOptions(mediaContent)
15755
+ : undefined,
15761
15756
  }));
15762
- t.mid = mid;
15757
+ transceiver.mid = mid;
15758
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
15759
+ transceiver.resetSdpMunger();
15760
+ (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
15761
+ this.createJmpSession(mediaType);
15762
+ });
15763
+ this.recvTransceivers.forEach((transceivers, mediaType) => {
15764
+ transceivers.forEach((t) => {
15765
+ const mid = this.midPredictor.getNextMid(mediaType);
15766
+ t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15767
+ direction: 'recvonly',
15768
+ }));
15769
+ t.mid = mid;
15770
+ });
15763
15771
  });
15764
15772
  });
15765
15773
  }