@stream-io/video-client 1.16.1 → 1.16.3

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.es.js CHANGED
@@ -32,6 +32,22 @@ const CreateDeviceRequestPushProviderEnum = {
32
32
  HUAWEI: 'huawei',
33
33
  XIAOMI: 'xiaomi',
34
34
  };
35
+ /**
36
+ * @export
37
+ */
38
+ const FrameRecordingSettingsRequestModeEnum = {
39
+ AVAILABLE: 'available',
40
+ DISABLED: 'disabled',
41
+ AUTO_ON: 'auto-on',
42
+ };
43
+ /**
44
+ * @export
45
+ */
46
+ const FrameRecordingSettingsResponseModeEnum = {
47
+ AVAILABLE: 'available',
48
+ DISABLED: 'disabled',
49
+ AUTO_ON: 'auto-on',
50
+ };
35
51
  /**
36
52
  * @export
37
53
  */
@@ -73,10 +89,12 @@ const OwnCapability = {
73
89
  SEND_VIDEO: 'send-video',
74
90
  START_BROADCAST_CALL: 'start-broadcast-call',
75
91
  START_CLOSED_CAPTIONS_CALL: 'start-closed-captions-call',
92
+ START_FRAME_RECORD_CALL: 'start-frame-record-call',
76
93
  START_RECORD_CALL: 'start-record-call',
77
94
  START_TRANSCRIPTION_CALL: 'start-transcription-call',
78
95
  STOP_BROADCAST_CALL: 'stop-broadcast-call',
79
96
  STOP_CLOSED_CAPTIONS_CALL: 'stop-closed-captions-call',
97
+ STOP_FRAME_RECORD_CALL: 'stop-frame-record-call',
80
98
  STOP_RECORD_CALL: 'stop-record-call',
81
99
  STOP_TRANSCRIPTION_CALL: 'stop-transcription-call',
82
100
  UPDATE_CALL: 'update-call',
@@ -5184,11 +5202,14 @@ class BasePeerConnection {
5184
5202
  */
5185
5203
  constructor(peerType, { sfuClient, connectionConfig, state, dispatcher, onUnrecoverableError, logTag, }) {
5186
5204
  this.isIceRestarting = false;
5205
+ this.isDisposed = false;
5187
5206
  this.subscriptions = [];
5188
5207
  /**
5189
5208
  * Disposes the `RTCPeerConnection` instance.
5190
5209
  */
5191
5210
  this.dispose = () => {
5211
+ this.onUnrecoverableError = undefined;
5212
+ this.isDisposed = true;
5192
5213
  this.detachEventHandlers();
5193
5214
  this.pc.close();
5194
5215
  };
@@ -5199,6 +5220,8 @@ class BasePeerConnection {
5199
5220
  this.on = (event, fn) => {
5200
5221
  this.subscriptions.push(this.dispatcher.on(event, (e) => {
5201
5222
  withoutConcurrency(`pc.${event}`, async () => fn(e)).catch((err) => {
5223
+ if (this.isDisposed)
5224
+ return;
5202
5225
  this.logger('warn', `Error handling ${event}`, err);
5203
5226
  });
5204
5227
  }));
@@ -5214,6 +5237,8 @@ class BasePeerConnection {
5214
5237
  this.unsubscribeIceTrickle?.();
5215
5238
  this.unsubscribeIceTrickle = createSafeAsyncSubscription(observable, async (candidate) => {
5216
5239
  return this.pc.addIceCandidate(candidate).catch((e) => {
5240
+ if (this.isDisposed)
5241
+ return;
5217
5242
  this.logger('warn', `ICE candidate error`, e, candidate);
5218
5243
  });
5219
5244
  });
@@ -5246,7 +5271,11 @@ class BasePeerConnection {
5246
5271
  const iceCandidate = this.toJSON(candidate);
5247
5272
  this.sfuClient
5248
5273
  .iceTrickle({ peerType: this.peerType, iceCandidate })
5249
- .catch((err) => this.logger('warn', `ICETrickle failed`, err));
5274
+ .catch((err) => {
5275
+ if (this.isDisposed)
5276
+ return;
5277
+ this.logger('warn', `ICETrickle failed`, err);
5278
+ });
5250
5279
  };
5251
5280
  /**
5252
5281
  * Converts the ICE candidate to a JSON string.
@@ -5275,6 +5304,8 @@ class BasePeerConnection {
5275
5304
  if (state === 'failed' || state === 'disconnected') {
5276
5305
  this.logger('debug', `Attempting to restart ICE`);
5277
5306
  this.restartIce().catch((e) => {
5307
+ if (this.isDisposed)
5308
+ return;
5278
5309
  this.logger('error', `ICE restart failed`, e);
5279
5310
  this.onUnrecoverableError?.();
5280
5311
  });
@@ -5326,6 +5357,8 @@ class BasePeerConnection {
5326
5357
  this.pc.removeEventListener('icecandidateerror', this.onIceCandidateError);
5327
5358
  this.pc.removeEventListener('signalingstatechange', this.onSignalingChange);
5328
5359
  this.pc.removeEventListener('iceconnectionstatechange', this.onIceConnectionStateChange);
5360
+ // cancel any ongoing ICE restart process
5361
+ withCancellation('onIceConnectionStateChange', () => Promise.resolve());
5329
5362
  this.pc.removeEventListener('icegatheringstatechange', this.onIceGatherChange);
5330
5363
  this.unsubscribeIceTrickle?.();
5331
5364
  this.subscriptions.forEach((unsubscribe) => unsubscribe());
@@ -5841,10 +5874,12 @@ class Publisher extends BasePeerConnection {
5841
5874
  await this.negotiate({ iceRestart: true });
5842
5875
  };
5843
5876
  this.onNegotiationNeeded = () => {
5844
- withoutConcurrency('publisher.negotiate', () => this.negotiate()).catch((err) => {
5877
+ withCancellation('publisher.negotiate', (signal) => this.negotiate().catch((err) => {
5878
+ if (signal.aborted)
5879
+ return;
5845
5880
  this.logger('error', `Negotiation failed.`, err);
5846
5881
  this.onUnrecoverableError?.();
5847
- });
5882
+ }));
5848
5883
  };
5849
5884
  /**
5850
5885
  * Initiates a new offer/answer exchange with the currently connected SFU.
@@ -5971,6 +6006,8 @@ class Publisher extends BasePeerConnection {
5971
6006
  detachEventHandlers() {
5972
6007
  super.detachEventHandlers();
5973
6008
  this.pc.removeEventListener('negotiationneeded', this.onNegotiationNeeded);
6009
+ // abort any ongoing negotiation
6010
+ withCancellation('publisher.negotiate', () => Promise.resolve());
5974
6011
  }
5975
6012
  }
5976
6013
 
@@ -7395,7 +7432,7 @@ const aggregate = (stats) => {
7395
7432
  return report;
7396
7433
  };
7397
7434
 
7398
- const version = "1.16.1";
7435
+ const version = "1.16.3";
7399
7436
  const [major, minor, patch] = version.split('.');
7400
7437
  let sdkInfo = {
7401
7438
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -11522,6 +11559,19 @@ class Call {
11522
11559
  this.stopRTMPBroadcast = async (name) => {
11523
11560
  return this.streamClient.post(`${this.streamClientBasePath}/rtmp_broadcasts/${name}/stop`);
11524
11561
  };
11562
+ /**
11563
+ * Starts frame by frame recording.
11564
+ * Sends call.frame_recording_started events
11565
+ */
11566
+ this.startFrameRecording = async (data) => {
11567
+ return this.streamClient.post(`${this.streamClientBasePath}/start_frame_recording`, data);
11568
+ };
11569
+ /**
11570
+ * Stops frame recording.
11571
+ */
11572
+ this.stopFrameRecording = async () => {
11573
+ return this.streamClient.post(`${this.streamClientBasePath}/stop_frame_recording`);
11574
+ };
11525
11575
  /**
11526
11576
  * Updates the call settings or custom data.
11527
11577
  *
@@ -11679,25 +11729,13 @@ class Call {
11679
11729
  * @param rating Rating between 1 and 5 denoting the experience of the user in the call
11680
11730
  * @param reason The reason/description for the rating
11681
11731
  * @param custom Custom data
11682
- * @returns
11683
11732
  */
11684
11733
  this.submitFeedback = async (rating, { reason, custom, } = {}) => {
11685
- if (rating < 1 || rating > 5) {
11686
- throw new Error('Rating must be between 1 and 5');
11687
- }
11688
- const callSessionId = this.state.session?.id;
11689
- if (!callSessionId) {
11690
- throw new Error('Feedback can be submitted only in the context of a call session');
11691
- }
11692
11734
  const { sdkName, sdkVersion, ...platform } = getSdkSignature(getClientDetails());
11693
- // user sessionId is not available once the call has been left
11694
- // until we relax the backend validation, we'll send N/A
11695
- const userSessionId = this.sfuClient?.sessionId ?? 'N/A';
11696
- const endpoint = `${this.streamClientBasePath}/feedback/${callSessionId}`;
11697
- return this.streamClient.post(endpoint, {
11735
+ return this.streamClient.post(`${this.streamClientBasePath}/feedback`, {
11698
11736
  rating,
11699
11737
  reason,
11700
- user_session_id: userSessionId,
11738
+ user_session_id: this.sfuClient?.sessionId,
11701
11739
  sdk: sdkName,
11702
11740
  sdk_version: sdkVersion,
11703
11741
  custom: {
@@ -13000,7 +13038,7 @@ class StreamClient {
13000
13038
  return await this.wsConnection.connect(this.defaultWSTimeout);
13001
13039
  };
13002
13040
  this.getUserAgent = () => {
13003
- const version = "1.16.1";
13041
+ const version = "1.16.3";
13004
13042
  return (this.userAgent ||
13005
13043
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13006
13044
  };
@@ -13509,5 +13547,5 @@ class StreamVideoClient {
13509
13547
  }
13510
13548
  StreamVideoClient._instanceMap = new Map();
13511
13549
 
13512
- export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestClosedCaptionModeEnum, TranscriptionSettingsRequestLanguageEnum, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseClosedCaptionModeEnum, TranscriptionSettingsResponseLanguageEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getDeviceState, getLogLevel, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio, hasScreenShare, hasScreenShareAudio, hasVideo, isPinned, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking };
13550
+ export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsResponseModeEnum, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestClosedCaptionModeEnum, TranscriptionSettingsRequestLanguageEnum, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseClosedCaptionModeEnum, TranscriptionSettingsResponseLanguageEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getDeviceState, getLogLevel, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio, hasScreenShare, hasScreenShareAudio, hasVideo, isPinned, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking };
13513
13551
  //# sourceMappingURL=index.es.js.map