@stream-io/video-client 1.16.2 → 1.16.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/index.cjs.js CHANGED
@@ -33,6 +33,22 @@ const CreateDeviceRequestPushProviderEnum = {
33
33
  HUAWEI: 'huawei',
34
34
  XIAOMI: 'xiaomi',
35
35
  };
36
+ /**
37
+ * @export
38
+ */
39
+ const FrameRecordingSettingsRequestModeEnum = {
40
+ AVAILABLE: 'available',
41
+ DISABLED: 'disabled',
42
+ AUTO_ON: 'auto-on',
43
+ };
44
+ /**
45
+ * @export
46
+ */
47
+ const FrameRecordingSettingsResponseModeEnum = {
48
+ AVAILABLE: 'available',
49
+ DISABLED: 'disabled',
50
+ AUTO_ON: 'auto-on',
51
+ };
36
52
  /**
37
53
  * @export
38
54
  */
@@ -74,10 +90,12 @@ const OwnCapability = {
74
90
  SEND_VIDEO: 'send-video',
75
91
  START_BROADCAST_CALL: 'start-broadcast-call',
76
92
  START_CLOSED_CAPTIONS_CALL: 'start-closed-captions-call',
93
+ START_FRAME_RECORD_CALL: 'start-frame-record-call',
77
94
  START_RECORD_CALL: 'start-record-call',
78
95
  START_TRANSCRIPTION_CALL: 'start-transcription-call',
79
96
  STOP_BROADCAST_CALL: 'stop-broadcast-call',
80
97
  STOP_CLOSED_CAPTIONS_CALL: 'stop-closed-captions-call',
98
+ STOP_FRAME_RECORD_CALL: 'stop-frame-record-call',
81
99
  STOP_RECORD_CALL: 'stop-record-call',
82
100
  STOP_TRANSCRIPTION_CALL: 'stop-transcription-call',
83
101
  UPDATE_CALL: 'update-call',
@@ -5187,15 +5205,6 @@ class BasePeerConnection {
5187
5205
  this.isIceRestarting = false;
5188
5206
  this.isDisposed = false;
5189
5207
  this.subscriptions = [];
5190
- /**
5191
- * Disposes the `RTCPeerConnection` instance.
5192
- */
5193
- this.dispose = () => {
5194
- this.onUnrecoverableError = undefined;
5195
- this.isDisposed = true;
5196
- this.detachEventHandlers();
5197
- this.pc.close();
5198
- };
5199
5208
  /**
5200
5209
  * Handles events synchronously.
5201
5210
  * Consecutive events are queued and executed one after the other.
@@ -5332,6 +5341,15 @@ class BasePeerConnection {
5332
5341
  this.pc.addEventListener('icegatheringstatechange', this.onIceGatherChange);
5333
5342
  this.pc.addEventListener('signalingstatechange', this.onSignalingChange);
5334
5343
  }
5344
+ /**
5345
+ * Disposes the `RTCPeerConnection` instance.
5346
+ */
5347
+ dispose() {
5348
+ this.onUnrecoverableError = undefined;
5349
+ this.isDisposed = true;
5350
+ this.detachEventHandlers();
5351
+ this.pc.close();
5352
+ }
5335
5353
  /**
5336
5354
  * Detaches the event handlers from the `RTCPeerConnection`.
5337
5355
  */
@@ -5692,7 +5710,9 @@ class Publisher extends BasePeerConnection {
5692
5710
  this.addTransceiver(trackToPublish, publishOption);
5693
5711
  }
5694
5712
  else {
5713
+ const previousTrack = transceiver.sender.track;
5695
5714
  await transceiver.sender.replaceTrack(trackToPublish);
5715
+ previousTrack?.stop();
5696
5716
  }
5697
5717
  }
5698
5718
  };
@@ -5784,6 +5804,14 @@ class Publisher extends BasePeerConnection {
5784
5804
  transceiver.sender.track?.stop();
5785
5805
  }
5786
5806
  };
5807
+ /**
5808
+ * Stops all the cloned tracks that are being published to the SFU.
5809
+ */
5810
+ this.stopAllTracks = () => {
5811
+ for (const { transceiver } of this.transceiverCache.items()) {
5812
+ transceiver.sender.track?.stop();
5813
+ }
5814
+ };
5787
5815
  this.changePublishQuality = async (videoSender) => {
5788
5816
  const { trackType, layers, publishOptionId } = videoSender;
5789
5817
  const enabledLayers = layers.filter((l) => l.active);
@@ -5992,6 +6020,13 @@ class Publisher extends BasePeerConnection {
5992
6020
  // abort any ongoing negotiation
5993
6021
  withCancellation('publisher.negotiate', () => Promise.resolve());
5994
6022
  }
6023
+ /**
6024
+ * Disposes this Publisher instance.
6025
+ */
6026
+ dispose() {
6027
+ super.dispose();
6028
+ this.stopAllTracks();
6029
+ }
5995
6030
  }
5996
6031
 
5997
6032
  /**
@@ -7415,7 +7450,7 @@ const aggregate = (stats) => {
7415
7450
  return report;
7416
7451
  };
7417
7452
 
7418
- const version = "1.16.2";
7453
+ const version = "1.16.4";
7419
7454
  const [major, minor, patch] = version.split('.');
7420
7455
  let sdkInfo = {
7421
7456
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -11542,6 +11577,19 @@ class Call {
11542
11577
  this.stopRTMPBroadcast = async (name) => {
11543
11578
  return this.streamClient.post(`${this.streamClientBasePath}/rtmp_broadcasts/${name}/stop`);
11544
11579
  };
11580
+ /**
11581
+ * Starts frame by frame recording.
11582
+ * Sends call.frame_recording_started events
11583
+ */
11584
+ this.startFrameRecording = async (data) => {
11585
+ return this.streamClient.post(`${this.streamClientBasePath}/start_frame_recording`, data);
11586
+ };
11587
+ /**
11588
+ * Stops frame recording.
11589
+ */
11590
+ this.stopFrameRecording = async () => {
11591
+ return this.streamClient.post(`${this.streamClientBasePath}/stop_frame_recording`);
11592
+ };
11545
11593
  /**
11546
11594
  * Updates the call settings or custom data.
11547
11595
  *
@@ -11699,25 +11747,13 @@ class Call {
11699
11747
  * @param rating Rating between 1 and 5 denoting the experience of the user in the call
11700
11748
  * @param reason The reason/description for the rating
11701
11749
  * @param custom Custom data
11702
- * @returns
11703
11750
  */
11704
11751
  this.submitFeedback = async (rating, { reason, custom, } = {}) => {
11705
- if (rating < 1 || rating > 5) {
11706
- throw new Error('Rating must be between 1 and 5');
11707
- }
11708
- const callSessionId = this.state.session?.id;
11709
- if (!callSessionId) {
11710
- throw new Error('Feedback can be submitted only in the context of a call session');
11711
- }
11712
11752
  const { sdkName, sdkVersion, ...platform } = getSdkSignature(getClientDetails());
11713
- // user sessionId is not available once the call has been left
11714
- // until we relax the backend validation, we'll send N/A
11715
- const userSessionId = this.sfuClient?.sessionId ?? 'N/A';
11716
- const endpoint = `${this.streamClientBasePath}/feedback/${callSessionId}`;
11717
- return this.streamClient.post(endpoint, {
11753
+ return this.streamClient.post(`${this.streamClientBasePath}/feedback`, {
11718
11754
  rating,
11719
11755
  reason,
11720
- user_session_id: userSessionId,
11756
+ user_session_id: this.sfuClient?.sessionId,
11721
11757
  sdk: sdkName,
11722
11758
  sdk_version: sdkVersion,
11723
11759
  custom: {
@@ -13020,7 +13056,7 @@ class StreamClient {
13020
13056
  return await this.wsConnection.connect(this.defaultWSTimeout);
13021
13057
  };
13022
13058
  this.getUserAgent = () => {
13023
- const version = "1.16.2";
13059
+ const version = "1.16.4";
13024
13060
  return (this.userAgent ||
13025
13061
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13026
13062
  };
@@ -13545,6 +13581,8 @@ exports.CameraManagerState = CameraManagerState;
13545
13581
  exports.CreateDeviceRequestPushProviderEnum = CreateDeviceRequestPushProviderEnum;
13546
13582
  exports.DynascaleManager = DynascaleManager;
13547
13583
  exports.ErrorFromResponse = ErrorFromResponse;
13584
+ exports.FrameRecordingSettingsRequestModeEnum = FrameRecordingSettingsRequestModeEnum;
13585
+ exports.FrameRecordingSettingsResponseModeEnum = FrameRecordingSettingsResponseModeEnum;
13548
13586
  exports.InputMediaDeviceManager = InputMediaDeviceManager;
13549
13587
  exports.InputMediaDeviceManagerState = InputMediaDeviceManagerState;
13550
13588
  exports.LayoutSettingsRequestNameEnum = LayoutSettingsRequestNameEnum;