@webex/web-client-media-engine 1.33.2 → 1.34.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/LICENSE.md CHANGED
@@ -1,3 +1,3 @@
1
1
  Copyright (c) 2022 Cisco Systems, Inc. and/or its affiliated entities.
2
2
 
3
- Your use of the Web Client Media Engine is subject to the Cisco End User License Agreement located at: https://www.cisco.com/c/dam/en_us/about/doing_business/legal/eula/cisco_end_user_license_agreement-eng.pdf
3
+ Your use of the web-client-media-engine (WCME) is subject to the Cisco End User License Agreement located at: https://www.cisco.com/c/dam/en_us/about/doing_business/legal/eula/cisco_end_user_license_agreement-eng.pdf
package/dist/cjs/index.js CHANGED
@@ -1154,7 +1154,12 @@ class LocalTrack extends EventEmitter$2 {
1154
1154
  * Cleanup local microphone track.
1155
1155
  */
1156
1156
  disposeEffects() {
1157
- this.effects.forEach((effect) => effect.dispose());
1157
+ if (this.effects.size > 0) {
1158
+ this.effects.forEach((effect) => effect.dispose());
1159
+ this.effects.clear();
1160
+ this.underlyingStream = this.originalStream;
1161
+ this.emit(exports.LocalTrackEvents.UnderlyingTrackChange);
1162
+ }
1158
1163
  }
1159
1164
  }
1160
1165
  LocalTrack.Events = exports.LocalTrackEvents;
@@ -9438,41 +9443,42 @@ class MultistreamConnection extends EventEmitter {
9438
9443
  this.overuseUpdateCallback = () => { };
9439
9444
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
9440
9445
  logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
9441
- this.pc = new PeerConnection();
9442
- this.pc.on(PeerConnection.Events.ConnectionStateChange, (state) => this.emit(exports.MultistreamConnectionEventNames.ConnectionStateUpdate, state));
9446
+ this.initializePeerConnection();
9443
9447
  this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
9444
9448
  this.overuseStateManager = new OveruseStateManager((overuseState) => this.overuseUpdateCallback(overuseState));
9445
9449
  this.overuseStateManager.start();
9446
9450
  this.statsManager = new StatsManager(() => this.pc.getStats(), (stats) => this.preProcessStats(stats));
9447
- this.attachMetricsObserver();
9448
9451
  const mainSceneId = generateSceneId();
9449
- const videoMainEncodingOptions = !this.options.disableSimulcast
9450
- ? [
9451
- { scaleResolutionDownBy: 4, active: false },
9452
- { scaleResolutionDownBy: 2, active: false },
9453
- { active: false },
9454
- ]
9455
- : [{ active: false }];
9452
+ const videoMainEncodingOptions = this.getVideoEncodingOptions();
9456
9453
  this.createSendTransceiver(MediaType.VideoMain, mainSceneId, videoMainEncodingOptions);
9457
9454
  this.createSendTransceiver(MediaType.AudioMain, mainSceneId);
9458
9455
  if (this.options.floorControlledPresentation) {
9459
- const videoPresentationEncodingOptions = !this.options
9460
- .disableSimulcast
9461
- ? [
9462
- { scaleResolutionDownBy: 4, active: false },
9463
- { scaleResolutionDownBy: 2, active: false },
9464
- { active: false },
9465
- ]
9466
- : [{ active: false }];
9456
+ const videoPresentationEncodingOptions = this.getVideoEncodingOptions();
9467
9457
  const contentSceneId = generateSceneId();
9468
9458
  this.createSendTransceiver(MediaType.VideoSlides, contentSceneId, videoPresentationEncodingOptions);
9469
9459
  this.createSendTransceiver(MediaType.AudioSlides, contentSceneId);
9470
9460
  }
9461
+ }
9462
+ initializePeerConnection() {
9463
+ var _a;
9464
+ (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
9465
+ this.pc = new PeerConnection();
9466
+ this.pc.on(PeerConnection.Events.ConnectionStateChange, (state) => this.emit(exports.MultistreamConnectionEventNames.ConnectionStateUpdate, state));
9467
+ this.attachMetricsObserver();
9471
9468
  this.createDataChannel();
9472
9469
  }
9473
9470
  getConnectionState() {
9474
9471
  return this.pc.getConnectionState();
9475
9472
  }
9473
+ getVideoEncodingOptions() {
9474
+ return !this.options.disableSimulcast
9475
+ ? [
9476
+ { scaleResolutionDownBy: 4, active: false },
9477
+ { scaleResolutionDownBy: 2, active: false },
9478
+ { active: false },
9479
+ ]
9480
+ : [{ active: false }];
9481
+ }
9476
9482
  createSendTransceiver(mediaType, sceneId, sendEncodingsOptions) {
9477
9483
  const rtcTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
9478
9484
  direction: 'sendrecv',
@@ -9480,6 +9486,9 @@ class MultistreamConnection extends EventEmitter {
9480
9486
  });
9481
9487
  const csi = generateCsi(getMediaFamily(mediaType), sceneId);
9482
9488
  this.sendTransceivers.set(mediaType, new SendOnlyTransceiver(rtcTransceiver, csi));
9489
+ this.createJmpSession(mediaType);
9490
+ }
9491
+ createJmpSession(mediaType) {
9483
9492
  const jmpSession = new JmpSession(getMediaFamily(mediaType), getMediaContent(mediaType));
9484
9493
  jmpSession.setTxCallback((msg) => {
9485
9494
  var _a;
@@ -9924,13 +9933,26 @@ class MultistreamConnection extends EventEmitter {
9924
9933
  this.pendingJmpTasks.push(task);
9925
9934
  }
9926
9935
  }
9927
- renewPeerConnection() {
9928
- var _a;
9929
- (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
9930
- this.pc = new PeerConnection();
9931
- this.attachMetricsObserver();
9932
- this.createDataChannel();
9933
- this.sendTransceivers.forEach((transceiver, mediaType) => transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType))));
9936
+ renewPeerConnection(userOptions) {
9937
+ if (userOptions) {
9938
+ this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
9939
+ }
9940
+ logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
9941
+ this.initializePeerConnection();
9942
+ this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
9943
+ const mainSceneId = generateSceneId();
9944
+ this.sendTransceivers.forEach((transceiver, mediaType) => {
9945
+ var _a;
9946
+ transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
9947
+ direction: 'sendrecv',
9948
+ sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
9949
+ ? this.getVideoEncodingOptions()
9950
+ : undefined,
9951
+ }));
9952
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), mainSceneId);
9953
+ (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
9954
+ this.createJmpSession(mediaType);
9955
+ });
9934
9956
  this.recvTransceivers.forEach((transceivers, mediaType) => {
9935
9957
  transceivers.forEach((t) => {
9936
9958
  t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {