@webex/web-client-media-engine 3.31.5 → 3.31.6

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
@@ -14522,6 +14522,7 @@ class SendOnlyTransceiver extends Transceiver {
14522
14522
  this.rtxEnabled = false;
14523
14523
  this.dtxDisabled = true;
14524
14524
  this.streamMuteStateChange = new TypedEvent();
14525
+ this.streamReadyStateChanged = new TypedEvent();
14525
14526
  this.streamPublishStateChange = new TypedEvent();
14526
14527
  this.negotiationNeeded = new TypedEvent();
14527
14528
  this.namedMediaGroupsChange = new TypedEvent();
@@ -14535,6 +14536,7 @@ class SendOnlyTransceiver extends Transceiver {
14535
14536
  this.handleTrackChange = this.handleTrackChange.bind(this);
14536
14537
  this.handleStreamConstraintsChange = this.handleStreamConstraintsChange.bind(this);
14537
14538
  this.handleStreamMuteStateChange = this.handleStreamMuteStateChange.bind(this);
14539
+ this.handleStreamEnded = this.handleStreamEnded.bind(this);
14538
14540
  }
14539
14541
  replaceSenderSource(stream) {
14540
14542
  var _a, _b;
@@ -14566,6 +14568,9 @@ class SendOnlyTransceiver extends Transceiver {
14566
14568
  handleStreamMuteStateChange() {
14567
14569
  this.streamMuteStateChange.emit();
14568
14570
  }
14571
+ handleStreamEnded() {
14572
+ this.streamReadyStateChanged.emit();
14573
+ }
14569
14574
  get requested() {
14570
14575
  return this.requestedIdEncodingParamsMap.size > 0;
14571
14576
  }
@@ -14588,6 +14593,7 @@ class SendOnlyTransceiver extends Transceiver {
14588
14593
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
14589
14594
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.UserMuteStateChange, this.handleStreamMuteStateChange);
14590
14595
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.SystemMuteStateChange, this.handleStreamMuteStateChange);
14596
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(StreamEventNames.Ended, this.handleStreamEnded);
14591
14597
  if (this.requested) {
14592
14598
  yield this.replaceSenderSource(newStream);
14593
14599
  }
@@ -14596,12 +14602,17 @@ class SendOnlyTransceiver extends Transceiver {
14596
14602
  newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
14597
14603
  newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.UserMuteStateChange, this.handleStreamMuteStateChange);
14598
14604
  newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.SystemMuteStateChange, this.handleStreamMuteStateChange);
14599
- if ((!oldStream && newStream && !newStream.muted) ||
14600
- (oldStream && !newStream && !oldStream.muted)) {
14605
+ newStream === null || newStream === void 0 ? void 0 : newStream.on(StreamEventNames.Ended, this.handleStreamEnded);
14606
+ if ((!oldStream && newStream) || (oldStream && !newStream)) {
14601
14607
  this.streamPublishStateChange.emit();
14602
14608
  }
14603
- else if ((oldStream === null || oldStream === void 0 ? void 0 : oldStream.muted) !== (newStream === null || newStream === void 0 ? void 0 : newStream.muted)) {
14604
- this.streamMuteStateChange.emit();
14609
+ if (oldStream && newStream) {
14610
+ if (oldStream.muted !== newStream.muted) {
14611
+ this.streamMuteStateChange.emit();
14612
+ }
14613
+ if (oldStream.readyState !== newStream.readyState) {
14614
+ this.streamReadyStateChanged.emit();
14615
+ }
14605
14616
  }
14606
14617
  });
14607
14618
  }
@@ -15087,6 +15098,10 @@ class MultistreamConnection extends EventEmitter$2 {
15087
15098
  this.sendSourceAdvertisement(mediaType);
15088
15099
  this.sendMediaRequestStatus(mediaType);
15089
15100
  });
15101
+ transceiver.streamReadyStateChanged.on(() => {
15102
+ this.sendSourceAdvertisement(mediaType);
15103
+ this.sendMediaRequestStatus(mediaType);
15104
+ });
15090
15105
  transceiver.negotiationNeeded.on((offerAnswerType) => {
15091
15106
  if (offerAnswerType === OfferAnswerType.Remote) {
15092
15107
  this.emit(MultistreamConnectionEventNames.NegotiationNeeded);
@@ -15320,9 +15335,12 @@ SCTP Max Message Size: ${maxMessageSize}`);
15320
15335
  }
15321
15336
  }
15322
15337
  sendSourceAdvertisement(mediaType) {
15323
- var _a, _b;
15338
+ var _a, _b, _c;
15324
15339
  const transceiver = this.getSendTransceiverOrThrow(mediaType);
15325
- const numLiveSources = ((_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.muted) === false ? 1 : 0;
15340
+ const numLiveSources = ((_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.muted) === false &&
15341
+ ((_b = transceiver.publishedStream) === null || _b === void 0 ? void 0 : _b.readyState) === 'live'
15342
+ ? 1
15343
+ : 0;
15326
15344
  let task;
15327
15345
  if (getMediaFamily(mediaType) === MediaFamily.Video) {
15328
15346
  const sources = this.getVideoStreamStates(mediaType);
@@ -15346,7 +15364,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
15346
15364
  .get(mediaType)) === null || _a === void 0 ? void 0 : _a.sendSourceAdvertisement(1, numLiveSources, mediaType === MediaType.AudioMain ? transceiver.namedMediaGroups : []);
15347
15365
  };
15348
15366
  }
15349
- if (((_b = this.dataChannel) === null || _b === void 0 ? void 0 : _b.readyState) === 'open') {
15367
+ if (((_c = this.dataChannel) === null || _c === void 0 ? void 0 : _c.readyState) === 'open') {
15350
15368
  task();
15351
15369
  }
15352
15370
  else {