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