@stream-io/video-client 1.15.7 → 1.16.1

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
@@ -10,8 +10,6 @@ var sdpTransform = require('sdp-transform');
10
10
  var uaParserJs = require('ua-parser-js');
11
11
  var https = require('https');
12
12
 
13
- /* tslint:disable */
14
- /* eslint-disable */
15
13
  /**
16
14
  * @export
17
15
  */
@@ -26,80 +24,6 @@ const AudioSettingsResponseDefaultDeviceEnum = {
26
24
  SPEAKER: 'speaker',
27
25
  EARPIECE: 'earpiece',
28
26
  };
29
- /**
30
- * @export
31
- */
32
- const BlockListOptionsBehaviorEnum = {
33
- FLAG: 'flag',
34
- BLOCK: 'block',
35
- SHADOW_BLOCK: 'shadow_block',
36
- };
37
- /**
38
- * @export
39
- */
40
- const ChannelConfigWithInfoAutomodEnum = {
41
- DISABLED: 'disabled',
42
- SIMPLE: 'simple',
43
- AI: 'AI',
44
- };
45
- /**
46
- * @export
47
- */
48
- const ChannelConfigWithInfoAutomodBehaviorEnum = {
49
- FLAG: 'flag',
50
- BLOCK: 'block',
51
- SHADOW_BLOCK: 'shadow_block',
52
- };
53
- /**
54
- * @export
55
- */
56
- const ChannelConfigWithInfoBlocklistBehaviorEnum = {
57
- FLAG: 'flag',
58
- BLOCK: 'block',
59
- SHADOW_BLOCK: 'shadow_block',
60
- };
61
- /**
62
- * All possibility of string to use
63
- * @export
64
- */
65
- const ChannelOwnCapability = {
66
- BAN_CHANNEL_MEMBERS: 'ban-channel-members',
67
- CAST_POLL_VOTE: 'cast-poll-vote',
68
- CONNECT_EVENTS: 'connect-events',
69
- CREATE_ATTACHMENT: 'create-attachment',
70
- CREATE_CALL: 'create-call',
71
- DELETE_ANY_MESSAGE: 'delete-any-message',
72
- DELETE_CHANNEL: 'delete-channel',
73
- DELETE_OWN_MESSAGE: 'delete-own-message',
74
- FLAG_MESSAGE: 'flag-message',
75
- FREEZE_CHANNEL: 'freeze-channel',
76
- JOIN_CALL: 'join-call',
77
- JOIN_CHANNEL: 'join-channel',
78
- LEAVE_CHANNEL: 'leave-channel',
79
- MUTE_CHANNEL: 'mute-channel',
80
- PIN_MESSAGE: 'pin-message',
81
- QUERY_POLL_VOTES: 'query-poll-votes',
82
- QUOTE_MESSAGE: 'quote-message',
83
- READ_EVENTS: 'read-events',
84
- SEARCH_MESSAGES: 'search-messages',
85
- SEND_CUSTOM_EVENTS: 'send-custom-events',
86
- SEND_LINKS: 'send-links',
87
- SEND_MESSAGE: 'send-message',
88
- SEND_POLL: 'send-poll',
89
- SEND_REACTION: 'send-reaction',
90
- SEND_REPLY: 'send-reply',
91
- SEND_TYPING_EVENTS: 'send-typing-events',
92
- SET_CHANNEL_COOLDOWN: 'set-channel-cooldown',
93
- SKIP_SLOW_MODE: 'skip-slow-mode',
94
- SLOW_MODE: 'slow-mode',
95
- TYPING_EVENTS: 'typing-events',
96
- UPDATE_ANY_MESSAGE: 'update-any-message',
97
- UPDATE_CHANNEL: 'update-channel',
98
- UPDATE_CHANNEL_MEMBERS: 'update-channel-members',
99
- UPDATE_OWN_MESSAGE: 'update-own-message',
100
- UPDATE_THREAD: 'update-thread',
101
- UPLOAD_FILE: 'upload-file',
102
- };
103
27
  /**
104
28
  * @export
105
29
  */
@@ -109,6 +33,16 @@ const CreateDeviceRequestPushProviderEnum = {
109
33
  HUAWEI: 'huawei',
110
34
  XIAOMI: 'xiaomi',
111
35
  };
36
+ /**
37
+ * @export
38
+ */
39
+ const LayoutSettingsRequestNameEnum = {
40
+ SPOTLIGHT: 'spotlight',
41
+ GRID: 'grid',
42
+ SINGLE_PARTICIPANT: 'single-participant',
43
+ MOBILE: 'mobile',
44
+ CUSTOM: 'custom',
45
+ };
112
46
  /**
113
47
  * @export
114
48
  */
@@ -151,6 +85,36 @@ const OwnCapability = {
151
85
  UPDATE_CALL_PERMISSIONS: 'update-call-permissions',
152
86
  UPDATE_CALL_SETTINGS: 'update-call-settings',
153
87
  };
88
+ /**
89
+ * @export
90
+ */
91
+ const RTMPBroadcastRequestQualityEnum = {
92
+ _360P: '360p',
93
+ _480P: '480p',
94
+ _720P: '720p',
95
+ _1080P: '1080p',
96
+ _1440P: '1440p',
97
+ PORTRAIT_360X640: 'portrait-360x640',
98
+ PORTRAIT_480X854: 'portrait-480x854',
99
+ PORTRAIT_720X1280: 'portrait-720x1280',
100
+ PORTRAIT_1080X1920: 'portrait-1080x1920',
101
+ PORTRAIT_1440X2560: 'portrait-1440x2560',
102
+ };
103
+ /**
104
+ * @export
105
+ */
106
+ const RTMPSettingsRequestQualityEnum = {
107
+ _360P: '360p',
108
+ _480P: '480p',
109
+ _720P: '720p',
110
+ _1080P: '1080p',
111
+ _1440P: '1440p',
112
+ PORTRAIT_360X640: 'portrait-360x640',
113
+ PORTRAIT_480X854: 'portrait-480x854',
114
+ PORTRAIT_720X1280: 'portrait-720x1280',
115
+ PORTRAIT_1080X1920: 'portrait-1080x1920',
116
+ PORTRAIT_1440X2560: 'portrait-1440x2560',
117
+ };
154
118
  /**
155
119
  * @export
156
120
  */
@@ -182,6 +146,44 @@ const TranscriptionSettingsRequestClosedCaptionModeEnum = {
182
146
  DISABLED: 'disabled',
183
147
  AUTO_ON: 'auto-on',
184
148
  };
149
+ /**
150
+ * @export
151
+ */
152
+ const TranscriptionSettingsRequestLanguageEnum = {
153
+ AUTO: 'auto',
154
+ EN: 'en',
155
+ FR: 'fr',
156
+ ES: 'es',
157
+ DE: 'de',
158
+ IT: 'it',
159
+ NL: 'nl',
160
+ PT: 'pt',
161
+ PL: 'pl',
162
+ CA: 'ca',
163
+ CS: 'cs',
164
+ DA: 'da',
165
+ EL: 'el',
166
+ FI: 'fi',
167
+ ID: 'id',
168
+ JA: 'ja',
169
+ RU: 'ru',
170
+ SV: 'sv',
171
+ TA: 'ta',
172
+ TH: 'th',
173
+ TR: 'tr',
174
+ HU: 'hu',
175
+ RO: 'ro',
176
+ ZH: 'zh',
177
+ AR: 'ar',
178
+ TL: 'tl',
179
+ HE: 'he',
180
+ HI: 'hi',
181
+ HR: 'hr',
182
+ KO: 'ko',
183
+ MS: 'ms',
184
+ NO: 'no',
185
+ UK: 'uk',
186
+ };
185
187
  /**
186
188
  * @export
187
189
  */
@@ -198,6 +200,44 @@ const TranscriptionSettingsResponseClosedCaptionModeEnum = {
198
200
  DISABLED: 'disabled',
199
201
  AUTO_ON: 'auto-on',
200
202
  };
203
+ /**
204
+ * @export
205
+ */
206
+ const TranscriptionSettingsResponseLanguageEnum = {
207
+ AUTO: 'auto',
208
+ EN: 'en',
209
+ FR: 'fr',
210
+ ES: 'es',
211
+ DE: 'de',
212
+ IT: 'it',
213
+ NL: 'nl',
214
+ PT: 'pt',
215
+ PL: 'pl',
216
+ CA: 'ca',
217
+ CS: 'cs',
218
+ DA: 'da',
219
+ EL: 'el',
220
+ FI: 'fi',
221
+ ID: 'id',
222
+ JA: 'ja',
223
+ RU: 'ru',
224
+ SV: 'sv',
225
+ TA: 'ta',
226
+ TH: 'th',
227
+ TR: 'tr',
228
+ HU: 'hu',
229
+ RO: 'ro',
230
+ ZH: 'zh',
231
+ AR: 'ar',
232
+ TL: 'tl',
233
+ HE: 'he',
234
+ HI: 'hi',
235
+ HR: 'hr',
236
+ KO: 'ko',
237
+ MS: 'ms',
238
+ NO: 'no',
239
+ UK: 'uk',
240
+ };
201
241
  /**
202
242
  * @export
203
243
  */
@@ -3858,6 +3898,8 @@ class StreamVideoWriteableStateStore {
3858
3898
  * @param call the call to remove
3859
3899
  */
3860
3900
  this.unregisterCall = (call) => {
3901
+ const logger = getLogger(['client-state']);
3902
+ logger('trace', `Unregistering call: ${call.cid}`);
3861
3903
  return this.setCalls((calls) => calls.filter((c) => c !== call));
3862
3904
  };
3863
3905
  /**
@@ -4185,7 +4227,7 @@ const livestreamOrAudioRoomSortPreset = combineComparators(ifInvisibleBy(combine
4185
4227
  */
4186
4228
  const defaultEgress = {
4187
4229
  broadcasting: false,
4188
- hls: { playlist_url: '' },
4230
+ hls: { playlist_url: '', status: '' },
4189
4231
  rtmps: [],
4190
4232
  };
4191
4233
  /**
@@ -4648,21 +4690,19 @@ class CallState {
4648
4690
  this.setCurrentValue(this.egressSubject, (egress = defaultEgress) => ({
4649
4691
  ...egress,
4650
4692
  broadcasting: false,
4693
+ hls: {
4694
+ ...egress.hls,
4695
+ status: '',
4696
+ },
4651
4697
  }));
4652
4698
  };
4653
4699
  this.updateFromHLSBroadcastingFailed = () => {
4654
4700
  this.setCurrentValue(this.egressSubject, (egress = defaultEgress) => ({
4655
4701
  ...egress,
4656
4702
  broadcasting: false,
4657
- }));
4658
- };
4659
- this.updateFromHLSBroadcastStarted = (event) => {
4660
- this.setCurrentValue(this.egressSubject, (egress = defaultEgress) => ({
4661
- ...egress,
4662
- broadcasting: true,
4663
4703
  hls: {
4664
4704
  ...egress.hls,
4665
- playlist_url: event.hls_playlist_url,
4705
+ status: '',
4666
4706
  },
4667
4707
  }));
4668
4708
  };
@@ -4873,21 +4913,16 @@ class CallState {
4873
4913
  this.captioning$ = duc(this.captioningSubject);
4874
4914
  this.eventHandlers = {
4875
4915
  // these events are not updating the call state:
4876
- 'call.deleted': undefined,
4877
4916
  'call.permission_request': undefined,
4878
4917
  'call.recording_ready': undefined,
4918
+ 'call.rtmp_broadcast_failed': undefined,
4919
+ 'call.rtmp_broadcast_started': undefined,
4920
+ 'call.rtmp_broadcast_stopped': undefined,
4879
4921
  'call.transcription_ready': undefined,
4880
4922
  'call.user_muted': undefined,
4881
4923
  'connection.error': undefined,
4882
4924
  'connection.ok': undefined,
4883
4925
  'health.check': undefined,
4884
- 'user.banned': undefined,
4885
- 'user.deactivated': undefined,
4886
- 'user.deleted': undefined,
4887
- 'user.muted': undefined,
4888
- 'user.presence.changed': undefined,
4889
- 'user.reactivated': undefined,
4890
- 'user.unbanned': undefined,
4891
4926
  'user.updated': undefined,
4892
4927
  custom: undefined,
4893
4928
  // events that update call state:
@@ -4904,12 +4939,15 @@ class CallState {
4904
4939
  this.setCurrentValue(this.captioningSubject, false);
4905
4940
  },
4906
4941
  'call.created': (e) => this.updateFromCallResponse(e.call),
4942
+ 'call.deleted': (e) => this.updateFromCallResponse(e.call),
4907
4943
  'call.ended': (e) => {
4908
4944
  this.updateFromCallResponse(e.call);
4909
4945
  this.setCurrentValue(this.endedBySubject, e.user);
4910
4946
  },
4911
4947
  'call.hls_broadcasting_failed': this.updateFromHLSBroadcastingFailed,
4912
- 'call.hls_broadcasting_started': this.updateFromHLSBroadcastStarted,
4948
+ 'call.hls_broadcasting_started': (e) => {
4949
+ this.updateFromCallResponse(e.call);
4950
+ },
4913
4951
  'call.hls_broadcasting_stopped': this.updateFromHLSBroadcastStopped,
4914
4952
  'call.live_started': (e) => this.updateFromCallResponse(e.call),
4915
4953
  'call.member_added': this.updateFromMemberAdded,
@@ -7358,7 +7396,7 @@ const aggregate = (stats) => {
7358
7396
  return report;
7359
7397
  };
7360
7398
 
7361
- const version = "1.15.7";
7399
+ const version = "1.16.1";
7362
7400
  const [major, minor, patch] = version.split('.');
7363
7401
  let sdkInfo = {
7364
7402
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -9215,10 +9253,34 @@ class CameraManager extends InputMediaDeviceManager {
9215
9253
  */
9216
9254
  async selectDirection(direction) {
9217
9255
  if (this.isDirectionSupportedByDevice()) {
9218
- this.state.setDirection(direction);
9219
- // Providing both device id and direction doesn't work, so we deselect the device
9220
- this.state.setDevice(undefined);
9221
- await this.applySettingsToStream();
9256
+ if (isReactNative()) {
9257
+ const videoTrack = this.getTracks()[0];
9258
+ if (!videoTrack)
9259
+ return;
9260
+ // @ts-expect-error _switchCamera() is only present in react-native-webrtc 124 and below
9261
+ if (typeof videoTrack._switchCamera === 'function') {
9262
+ // @ts-expect-error for older versions of react-native-webrtc support
9263
+ videoTrack._switchCamera();
9264
+ }
9265
+ else {
9266
+ const constraints = {
9267
+ facingMode: direction === 'front' ? 'user' : 'environment',
9268
+ };
9269
+ await videoTrack.applyConstraints(constraints);
9270
+ }
9271
+ this.state.setDirection(direction);
9272
+ this.state.setDevice(undefined);
9273
+ }
9274
+ else {
9275
+ // web mobile
9276
+ this.state.setDirection(direction);
9277
+ // Providing both device id and direction doesn't work, so we deselect the device
9278
+ this.state.setDevice(undefined);
9279
+ this.getTracks().forEach((track) => {
9280
+ track.stop();
9281
+ });
9282
+ await this.unmuteStream();
9283
+ }
9222
9284
  }
9223
9285
  else {
9224
9286
  this.logger('warn', 'Camera direction ignored for desktop devices');
@@ -10412,6 +10474,12 @@ class Call {
10412
10474
  this.create = async (data) => {
10413
10475
  return this.getOrCreate(data);
10414
10476
  };
10477
+ /**
10478
+ * Deletes the call.
10479
+ */
10480
+ this.delete = async (data = {}) => {
10481
+ return this.streamClient.post(`${this.streamClientBasePath}/delete`, data);
10482
+ };
10415
10483
  /**
10416
10484
  * A shortcut for {@link Call.get} with `ring` parameter set to `true`.
10417
10485
  * Will send a `call.ring` event to the call members.
@@ -11422,8 +11490,8 @@ class Call {
11422
11490
  /**
11423
11491
  * Stops the livestreaming of the call.
11424
11492
  */
11425
- this.stopLive = async () => {
11426
- return this.streamClient.post(`${this.streamClientBasePath}/stop_live`, {});
11493
+ this.stopLive = async (data = {}) => {
11494
+ return this.streamClient.post(`${this.streamClientBasePath}/stop_live`, data);
11427
11495
  };
11428
11496
  /**
11429
11497
  * Starts the broadcasting of the call.
@@ -11437,6 +11505,24 @@ class Call {
11437
11505
  this.stopHLS = async () => {
11438
11506
  return this.streamClient.post(`${this.streamClientBasePath}/stop_broadcasting`, {});
11439
11507
  };
11508
+ /**
11509
+ * Starts the RTMP-out broadcasting of the call.
11510
+ */
11511
+ this.startRTMPBroadcasts = async (data) => {
11512
+ return this.streamClient.post(`${this.streamClientBasePath}/rtmp_broadcasts`, data);
11513
+ };
11514
+ /**
11515
+ * Stops all RTMP-out broadcasting of the call.
11516
+ */
11517
+ this.stopAllRTMPBroadcasts = async () => {
11518
+ return this.streamClient.post(`${this.streamClientBasePath}/rtmp_broadcasts/stop`);
11519
+ };
11520
+ /**
11521
+ * Stops the RTMP-out broadcasting of the call specified by it's name.
11522
+ */
11523
+ this.stopRTMPBroadcast = async (name) => {
11524
+ return this.streamClient.post(`${this.streamClientBasePath}/rtmp_broadcasts/${name}/stop`);
11525
+ };
11440
11526
  /**
11441
11527
  * Updates the call settings or custom data.
11442
11528
  *
@@ -12915,7 +13001,7 @@ class StreamClient {
12915
13001
  return await this.wsConnection.connect(this.defaultWSTimeout);
12916
13002
  };
12917
13003
  this.getUserAgent = () => {
12918
- const version = "1.15.7";
13004
+ const version = "1.16.1";
12919
13005
  return (this.userAgent ||
12920
13006
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12921
13007
  };
@@ -13430,7 +13516,6 @@ Object.defineProperty(exports, "AxiosError", {
13430
13516
  });
13431
13517
  exports.AudioSettingsRequestDefaultDeviceEnum = AudioSettingsRequestDefaultDeviceEnum;
13432
13518
  exports.AudioSettingsResponseDefaultDeviceEnum = AudioSettingsResponseDefaultDeviceEnum;
13433
- exports.BlockListOptionsBehaviorEnum = BlockListOptionsBehaviorEnum;
13434
13519
  exports.Browsers = browsers;
13435
13520
  exports.Call = Call;
13436
13521
  exports.CallState = CallState;
@@ -13438,19 +13523,18 @@ exports.CallType = CallType;
13438
13523
  exports.CallTypes = CallTypes;
13439
13524
  exports.CameraManager = CameraManager;
13440
13525
  exports.CameraManagerState = CameraManagerState;
13441
- exports.ChannelConfigWithInfoAutomodBehaviorEnum = ChannelConfigWithInfoAutomodBehaviorEnum;
13442
- exports.ChannelConfigWithInfoAutomodEnum = ChannelConfigWithInfoAutomodEnum;
13443
- exports.ChannelConfigWithInfoBlocklistBehaviorEnum = ChannelConfigWithInfoBlocklistBehaviorEnum;
13444
- exports.ChannelOwnCapability = ChannelOwnCapability;
13445
13526
  exports.CreateDeviceRequestPushProviderEnum = CreateDeviceRequestPushProviderEnum;
13446
13527
  exports.DynascaleManager = DynascaleManager;
13447
13528
  exports.ErrorFromResponse = ErrorFromResponse;
13448
13529
  exports.InputMediaDeviceManager = InputMediaDeviceManager;
13449
13530
  exports.InputMediaDeviceManagerState = InputMediaDeviceManagerState;
13531
+ exports.LayoutSettingsRequestNameEnum = LayoutSettingsRequestNameEnum;
13450
13532
  exports.MicrophoneManager = MicrophoneManager;
13451
13533
  exports.MicrophoneManagerState = MicrophoneManagerState;
13452
13534
  exports.NoiseCancellationSettingsModeEnum = NoiseCancellationSettingsModeEnum;
13453
13535
  exports.OwnCapability = OwnCapability;
13536
+ exports.RTMPBroadcastRequestQualityEnum = RTMPBroadcastRequestQualityEnum;
13537
+ exports.RTMPSettingsRequestQualityEnum = RTMPSettingsRequestQualityEnum;
13454
13538
  exports.RecordSettingsRequestModeEnum = RecordSettingsRequestModeEnum;
13455
13539
  exports.RecordSettingsRequestQualityEnum = RecordSettingsRequestQualityEnum;
13456
13540
  exports.RxUtils = rxUtils;
@@ -13465,8 +13549,10 @@ exports.StreamVideoClient = StreamVideoClient;
13465
13549
  exports.StreamVideoReadOnlyStateStore = StreamVideoReadOnlyStateStore;
13466
13550
  exports.StreamVideoWriteableStateStore = StreamVideoWriteableStateStore;
13467
13551
  exports.TranscriptionSettingsRequestClosedCaptionModeEnum = TranscriptionSettingsRequestClosedCaptionModeEnum;
13552
+ exports.TranscriptionSettingsRequestLanguageEnum = TranscriptionSettingsRequestLanguageEnum;
13468
13553
  exports.TranscriptionSettingsRequestModeEnum = TranscriptionSettingsRequestModeEnum;
13469
13554
  exports.TranscriptionSettingsResponseClosedCaptionModeEnum = TranscriptionSettingsResponseClosedCaptionModeEnum;
13555
+ exports.TranscriptionSettingsResponseLanguageEnum = TranscriptionSettingsResponseLanguageEnum;
13470
13556
  exports.TranscriptionSettingsResponseModeEnum = TranscriptionSettingsResponseModeEnum;
13471
13557
  exports.VideoSettingsRequestCameraFacingEnum = VideoSettingsRequestCameraFacingEnum;
13472
13558
  exports.VideoSettingsResponseCameraFacingEnum = VideoSettingsResponseCameraFacingEnum;