@webex/web-client-media-engine 1.38.3 → 1.39.0

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
@@ -8864,7 +8864,7 @@ function injectContentTypes(sdp, contentTypeMap) {
8864
8864
  }
8865
8865
  function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
8866
8866
  parsedSdp.avMedia
8867
- .filter((mLine) => mLine.direction === 'sendrecv' || mLine.direction === 'sendonly')
8867
+ .filter((mLine) => mLine.direction === 'sendrecv' || mLine.direction === 'inactive')
8868
8868
  .forEach((mLine) => {
8869
8869
  if (!mLine.otherLines.find((line) => line instanceof JmpLine)) {
8870
8870
  mLine.addLine(new JmpLine());
@@ -8888,6 +8888,7 @@ class SendOnlyTransceiver extends Transceiver {
8888
8888
  super(rtcpRtpTransceiver);
8889
8889
  this.requested = false;
8890
8890
  this.csi = csi;
8891
+ this.direction = 'sendrecv';
8891
8892
  this.handleTrackChange = this.handleTrackChange.bind(this);
8892
8893
  }
8893
8894
  handleTrackChange() {
@@ -8905,6 +8906,7 @@ class SendOnlyTransceiver extends Transceiver {
8905
8906
  var _a;
8906
8907
  return __awaiter(this, void 0, void 0, function* () {
8907
8908
  _super.replaceTransceiver.call(this, newRtcRtpTransceiver);
8909
+ newRtcRtpTransceiver.direction = this.direction;
8908
8910
  if (this.requested) {
8909
8911
  yield this.sender.replaceTrack(((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null);
8910
8912
  }
@@ -8975,8 +8977,8 @@ class SendOnlyTransceiver extends Transceiver {
8975
8977
  return this.replacePublishedTrack();
8976
8978
  }
8977
8979
  setActive(enabled) {
8978
- const direction = enabled ? 'sendrecv' : 'inactive';
8979
- this._rtcRtpTransceiver.direction = direction;
8980
+ this.direction = enabled ? 'sendrecv' : 'inactive';
8981
+ this._rtcRtpTransceiver.direction = this.direction;
8980
8982
  return this._rtcRtpTransceiver.direction !== this._rtcRtpTransceiver.currentDirection;
8981
8983
  }
8982
8984
  getStats() {
@@ -9599,9 +9601,12 @@ const defaultMultistreamConnectionOptions = {
9599
9601
  bundlePolicy: 'max-compat',
9600
9602
  iceServers: undefined,
9601
9603
  disableContentSimulcast: true,
9604
+ enableMainAudio: true,
9605
+ enableMainVideo: true,
9602
9606
  };
9603
9607
  class MultistreamConnection extends EventEmitter {
9604
9608
  constructor(userOptions = {}) {
9609
+ var _a, _b;
9605
9610
  super();
9606
9611
  this.sendTransceivers = new Map();
9607
9612
  this.recvTransceivers = new Map();
@@ -9622,6 +9627,8 @@ class MultistreamConnection extends EventEmitter {
9622
9627
  const videoMainEncodingOptions = this.getVideoEncodingOptions(MediaContent.Main);
9623
9628
  this.createSendTransceiver(MediaType.VideoMain, mainSceneId, videoMainEncodingOptions);
9624
9629
  this.createSendTransceiver(MediaType.AudioMain, mainSceneId);
9630
+ (_a = this.sendTransceivers.get(MediaType.VideoMain)) === null || _a === void 0 ? void 0 : _a.setActive(this.options.enableMainVideo);
9631
+ (_b = this.sendTransceivers.get(MediaType.AudioMain)) === null || _b === void 0 ? void 0 : _b.setActive(this.options.enableMainAudio);
9625
9632
  if (this.options.floorControlledPresentation) {
9626
9633
  const videoPresentationEncodingOptions = this.getVideoEncodingOptions(MediaContent.Slides);
9627
9634
  const contentSceneId = generateSceneId();
@@ -10161,15 +10168,25 @@ class MultistreamConnection extends EventEmitter {
10161
10168
  requestMedia(mediaType, mediaRequests) {
10162
10169
  var _a;
10163
10170
  const task = () => {
10171
+ var _a;
10164
10172
  const jmpSession = this.jmpSessions.get(mediaType);
10165
10173
  if (!jmpSession) {
10166
10174
  logger.error(`Unable to find jmp session for ${mediaType}`);
10167
10175
  return;
10168
10176
  }
10169
- if (!mediaRequests.every((mr) => mr.receiveSlots.every((rs) => rs.id))) {
10170
- logger.error(`Running subscribe task, but ReceiveSlot ID is missing!`);
10171
- return;
10172
- }
10177
+ const requestedReceiveSlotIds = [];
10178
+ mediaRequests.forEach((mr) => mr.receiveSlots.forEach((rs) => {
10179
+ if (!rs.id) {
10180
+ logger.error(`Running subscribe task, but ReceiveSlot ID is missing!`);
10181
+ return;
10182
+ }
10183
+ requestedReceiveSlotIds.push(rs.id);
10184
+ }));
10185
+ (_a = this.recvTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.forEach((transceiver) => {
10186
+ if (!requestedReceiveSlotIds.some((id) => compareStreamIds(id, transceiver.receiveSlot.id))) {
10187
+ transceiver.receiveSlot._updateSource('no source', undefined);
10188
+ }
10189
+ });
10173
10190
  jmpSession.sendRequests(mediaRequests.map((mr) => mr._toJmpScrRequest()));
10174
10191
  };
10175
10192
  if (((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.readyState) === 'open') {