@webex/web-client-media-engine 3.8.3 → 3.8.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
@@ -13840,11 +13840,23 @@ class SendOnlyTransceiver extends Transceiver {
13840
13840
  this.munger = munger;
13841
13841
  this.mediaType = mediaType;
13842
13842
  }
13843
- handleTrackChange() {
13843
+ replaceSenderSource(stream) {
13844
13844
  var _a;
13845
+ return __awaiter(this, void 0, void 0, function* () {
13846
+ const trackOrNull = (_a = stream === null || stream === void 0 ? void 0 : stream.outputStream.getTracks()[0]) !== null && _a !== void 0 ? _a : null;
13847
+ yield this.sender.replaceTrack(trackOrNull);
13848
+ if (trackOrNull) {
13849
+ logger.log(`Sender source for ${this.mediaType} replaced with track ID ${trackOrNull.id}`);
13850
+ }
13851
+ else {
13852
+ logger.log(`Sender source for ${this.mediaType} set to null, sender stopped`);
13853
+ }
13854
+ });
13855
+ }
13856
+ handleTrackChange() {
13845
13857
  return __awaiter(this, void 0, void 0, function* () {
13846
13858
  if (this.requested) {
13847
- yield this.sender.replaceTrack(((_a = this.publishedStream) === null || _a === void 0 ? void 0 : _a.outputStream.getTracks()[0]) || null);
13859
+ yield this.replaceSenderSource(this.publishedStream);
13848
13860
  }
13849
13861
  });
13850
13862
  }
@@ -13863,12 +13875,11 @@ class SendOnlyTransceiver extends Transceiver {
13863
13875
  const _super = Object.create(null, {
13864
13876
  replaceTransceiver: { get: () => super.replaceTransceiver }
13865
13877
  });
13866
- var _a;
13867
13878
  return __awaiter(this, void 0, void 0, function* () {
13868
13879
  _super.replaceTransceiver.call(this, newRtcRtpTransceiver);
13869
13880
  newRtcRtpTransceiver.direction = this.direction;
13870
13881
  if (this.requested) {
13871
- yield this.sender.replaceTrack(((_a = this.publishedStream) === null || _a === void 0 ? void 0 : _a.outputStream.getTracks()[0]) || null);
13882
+ yield this.replaceSenderSource(this.publishedStream);
13872
13883
  }
13873
13884
  });
13874
13885
  }
@@ -13879,7 +13890,7 @@ class SendOnlyTransceiver extends Transceiver {
13879
13890
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(exports.LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
13880
13891
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(exports.StreamEventNames.MuteStateChange, this.handleStreamMuteStateChange);
13881
13892
  if (this.requested) {
13882
- yield this.sender.replaceTrack((newStream === null || newStream === void 0 ? void 0 : newStream.outputStream.getTracks()[0]) || null);
13893
+ yield this.replaceSenderSource(newStream);
13883
13894
  }
13884
13895
  this.publishedStream = newStream;
13885
13896
  newStream === null || newStream === void 0 ? void 0 : newStream.on(exports.LocalStreamEventNames.OutputTrackChange, this.handleTrackChange);
@@ -13926,7 +13937,7 @@ class SendOnlyTransceiver extends Transceiver {
13926
13937
  if (this.publishedStream) {
13927
13938
  const requested = requestedIdEncodingParamsMap.size > 0;
13928
13939
  if (this.requested !== requested) {
13929
- this.sender.replaceTrack(requested ? this.publishedStream.outputStream.getTracks()[0] || null : null);
13940
+ this.replaceSenderSource(requested ? this.publishedStream : null);
13930
13941
  }
13931
13942
  const sendParameters = this.sender.getParameters();
13932
13943
  sendParameters.encodings.forEach((encoding, index) => {