@webex/web-client-media-engine 2.0.9 → 2.1.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/esm/index.js CHANGED
@@ -557,6 +557,28 @@ function createDisplayTrack(constructor, videoContentHint) {
557
557
  return new constructor(stream, videoContentHint);
558
558
  });
559
559
  }
560
+ /**
561
+ * Creates a display video track and a system audio track.
562
+ *
563
+ * @param videoTrackConstructor - Constructor for the local display track.
564
+ * @param audioTrackConstructor - Constructor for the local system audio track.
565
+ * @param videoContentHint - An optional parameter to give a hint for the content of the track.
566
+ * @returns A Promise that resolves to a LocalDisplayTrack and a LocalSystemAudioTrack. If no system
567
+ * audio is available, the LocalSystemAudioTrack will be resolved as null instead.
568
+ */
569
+ function createDisplayTrackWithAudio(videoTrackConstructor, audioTrackConstructor, videoContentHint) {
570
+ return __awaiter$1(this, void 0, void 0, function* () {
571
+ const stream = yield getDisplayMedia({ video: true, audio: true });
572
+ // eslint-disable-next-line new-cap
573
+ const videoTrack = new videoTrackConstructor(new MediaStream(stream.getVideoTracks()), videoContentHint);
574
+ let audioTrack = null;
575
+ if (stream.getAudioTracks().length > 0) {
576
+ // eslint-disable-next-line new-cap
577
+ audioTrack = new audioTrackConstructor(new MediaStream(stream.getAudioTracks()));
578
+ }
579
+ return [videoTrack, audioTrack];
580
+ });
581
+ }
560
582
  /**
561
583
  * Enumerates the media input and output devices available.
562
584
  *
@@ -1410,6 +1432,12 @@ class LocalDisplayTrack extends LocalTrack {
1410
1432
  class LocalMicrophoneTrack extends LocalTrack {
1411
1433
  }
1412
1434
 
1435
+ /**
1436
+ * Represents a local track for system audio.
1437
+ */
1438
+ class LocalSystemAudioTrack extends LocalTrack {
1439
+ }
1440
+
1413
1441
  // Overall connection state (based on the ICE and DTLS connection states)
1414
1442
  var ConnectionState;
1415
1443
  (function (ConnectionState) {
@@ -13465,7 +13493,8 @@ class MultistreamConnection extends EventEmitter {
13465
13493
  publishTrack(track) {
13466
13494
  return __awaiter(this, void 0, void 0, function* () {
13467
13495
  let mediaContent;
13468
- if (track instanceof LocalDisplayTrack && this.options.floorControlledPresentation) {
13496
+ if ((track instanceof LocalDisplayTrack || track instanceof LocalSystemAudioTrack) &&
13497
+ this.options.floorControlledPresentation) {
13469
13498
  mediaContent = MediaContent.Slides;
13470
13499
  }
13471
13500
  else {
@@ -13485,7 +13514,8 @@ class MultistreamConnection extends EventEmitter {
13485
13514
  unpublishTrack(track) {
13486
13515
  return __awaiter(this, void 0, void 0, function* () {
13487
13516
  let mediaContent;
13488
- if (track instanceof LocalDisplayTrack && this.options.floorControlledPresentation) {
13517
+ if ((track instanceof LocalDisplayTrack || track instanceof LocalSystemAudioTrack) &&
13518
+ this.options.floorControlledPresentation) {
13489
13519
  mediaContent = MediaContent.Slides;
13490
13520
  }
13491
13521
  else {
@@ -13863,16 +13893,19 @@ class MultistreamConnection extends EventEmitter {
13863
13893
  this.initializePeerConnection();
13864
13894
  this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
13865
13895
  const mainSceneId = generateSceneId();
13896
+ const slidesSceneId = generateSceneId();
13866
13897
  this.sendTransceivers.forEach((transceiver, mediaType) => {
13867
13898
  var _a;
13899
+ const mediaContent = getMediaContent(mediaType);
13900
+ const sceneId = mediaContent === MediaContent.Main ? mainSceneId : slidesSceneId;
13868
13901
  this.addMid(mediaType);
13869
13902
  transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
13870
13903
  direction: 'sendrecv',
13871
13904
  sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
13872
- ? this.getVideoEncodingOptions(getMediaContent(mediaType))
13905
+ ? this.getVideoEncodingOptions(mediaContent)
13873
13906
  : undefined,
13874
13907
  }));
13875
- transceiver.csi = generateCsi(getMediaFamily(mediaType), mainSceneId);
13908
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
13876
13909
  (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
13877
13910
  this.createJmpSession(mediaType);
13878
13911
  });
@@ -13977,5 +14010,5 @@ class StreamRequest {
13977
14010
  }
13978
14011
  }
13979
14012
 
13980
- export { ConnectionState, Logger$1 as JMPLogger, LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack, LocalTrack, LocalTrackEvents, Logger, MediaCodecMimeType, MediaStreamTrackKind, MultistreamConnection, MultistreamConnectionEventNames, PeerConnection, ReceiveSlot, ReceiveSlotEvents, RecommendedOpusBitrates, SendOnlyTransceiver, StreamRequest, WcmeError, compareReceiveSlotIds, createCameraTrack, createDisplayTrack, createMicrophoneTrack, getAudioInputDevices, getAudioOutputDevices, getDevices, getLogLevel, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, logger, setLogHandler, setLogLevel, setOnDeviceChangeHandler };
14013
+ export { ConnectionState, Logger$1 as JMPLogger, LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack, LocalSystemAudioTrack, LocalTrack, LocalTrackEvents, Logger, MediaCodecMimeType, MediaStreamTrackKind, MultistreamConnection, MultistreamConnectionEventNames, PeerConnection, ReceiveSlot, ReceiveSlotEvents, RecommendedOpusBitrates, SendOnlyTransceiver, StreamRequest, WcmeError, compareReceiveSlotIds, createCameraTrack, createDisplayTrack, createDisplayTrackWithAudio, createMicrophoneTrack, getAudioInputDevices, getAudioOutputDevices, getDevices, getLogLevel, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, logger, setLogHandler, setLogLevel, setOnDeviceChangeHandler };
13981
14014
  //# sourceMappingURL=index.js.map