@stream-io/video-client 0.3.25 → 0.3.26

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
@@ -57,6 +57,26 @@ const CreateDeviceRequestPushProviderEnum = {
57
57
  HUAWEI: 'huawei',
58
58
  XIAOMI: 'xiaomi',
59
59
  };
60
+ /**
61
+ * @export
62
+ */
63
+ const LayoutSettingsNameEnum = {
64
+ SPOTLIGHT: 'spotlight',
65
+ GRID: 'grid',
66
+ SINGLE_PARTICIPANT: 'single-participant',
67
+ MOBILE: 'mobile',
68
+ CUSTOM: 'custom',
69
+ };
70
+ /**
71
+ * @export
72
+ */
73
+ const LayoutSettingsRequestNameEnum = {
74
+ SPOTLIGHT: 'spotlight',
75
+ GRID: 'grid',
76
+ SINGLE_PARTICIPANT: 'single-participant',
77
+ MOBILE: 'mobile',
78
+ CUSTOM: 'custom',
79
+ };
60
80
  /**
61
81
  * All possibility of string to use
62
82
  * @export
@@ -87,25 +107,6 @@ const OwnCapability = {
87
107
  UPDATE_CALL_PERMISSIONS: 'update-call-permissions',
88
108
  UPDATE_CALL_SETTINGS: 'update-call-settings',
89
109
  };
90
- /**
91
- * @export
92
- */
93
- const RecordSettingsModeEnum = {
94
- AVAILABLE: 'available',
95
- DISABLED: 'disabled',
96
- AUTO_ON: 'auto-on',
97
- };
98
- /**
99
- * @export
100
- */
101
- const RecordSettingsQualityEnum = {
102
- AUDIO_ONLY: 'audio-only',
103
- _360P: '360p',
104
- _480P: '480p',
105
- _720P: '720p',
106
- _1080P: '1080p',
107
- _1440P: '1440p',
108
- };
109
110
  /**
110
111
  * @export
111
112
  */
@@ -118,7 +119,6 @@ const RecordSettingsRequestModeEnum = {
118
119
  * @export
119
120
  */
120
121
  const RecordSettingsRequestQualityEnum = {
121
- AUDIO_ONLY: 'audio-only',
122
122
  _360P: '360p',
123
123
  _480P: '480p',
124
124
  _720P: '720p',
@@ -8014,6 +8014,7 @@ class CallState {
8014
8014
  this.settingsSubject = new rxjs.BehaviorSubject(undefined);
8015
8015
  this.transcribingSubject = new rxjs.BehaviorSubject(false);
8016
8016
  this.endedBySubject = new rxjs.BehaviorSubject(undefined);
8017
+ this.thumbnailsSubject = new rxjs.BehaviorSubject(undefined);
8017
8018
  this.membersSubject = new rxjs.BehaviorSubject([]);
8018
8019
  this.ownCapabilitiesSubject = new rxjs.BehaviorSubject([]);
8019
8020
  this.callingStateSubject = new rxjs.BehaviorSubject(exports.CallingState.UNKNOWN);
@@ -8274,6 +8275,7 @@ class CallState {
8274
8275
  this.setCurrentValue(this.sessionSubject, call.session);
8275
8276
  this.setCurrentValue(this.settingsSubject, call.settings);
8276
8277
  this.setCurrentValue(this.transcribingSubject, call.transcribing);
8278
+ this.setCurrentValue(this.thumbnailsSubject, call.thumbnails);
8277
8279
  };
8278
8280
  this.updateFromMemberRemoved = (event) => {
8279
8281
  this.setCurrentValue(this.membersSubject, (members) => members.filter((m) => event.members.indexOf(m.user_id) === -1));
@@ -8284,10 +8286,10 @@ class CallState {
8284
8286
  ...event.members,
8285
8287
  ]);
8286
8288
  };
8287
- this.updateFromBroadcastStopped = () => {
8289
+ this.updateFromHLSBroadcastStopped = () => {
8288
8290
  this.setCurrentValue(this.egressSubject, (egress) => (Object.assign(Object.assign({}, egress), { broadcasting: false })));
8289
8291
  };
8290
- this.updateFromBroadcastStarted = (event) => {
8292
+ this.updateFromHLSBroadcastStarted = (event) => {
8291
8293
  this.setCurrentValue(this.egressSubject, (egress) => (Object.assign(Object.assign({}, egress), { broadcasting: true, hls: Object.assign(Object.assign({}, egress.hls), { playlist_url: event.hls_playlist_url }) })));
8292
8294
  };
8293
8295
  this.updateFromSessionParticipantLeft = (event) => {
@@ -8385,6 +8387,7 @@ class CallState {
8385
8387
  this.settings$ = this.settingsSubject.asObservable();
8386
8388
  this.transcribing$ = this.transcribingSubject.asObservable();
8387
8389
  this.endedBy$ = this.endedBySubject.asObservable();
8390
+ this.thumbnails$ = this.thumbnailsSubject.asObservable();
8388
8391
  this.eventHandlers = {
8389
8392
  // these events are not updating the call state:
8390
8393
  'call.permission_request': undefined,
@@ -8398,7 +8401,10 @@ class CallState {
8398
8401
  // events that update call state:
8399
8402
  'call.accepted': (e) => this.updateFromCallResponse(e.call),
8400
8403
  'call.created': (e) => this.updateFromCallResponse(e.call),
8401
- 'call.notification': (e) => this.updateFromCallResponse(e.call),
8404
+ 'call.notification': (e) => {
8405
+ this.updateFromCallResponse(e.call);
8406
+ this.setMembers(e.members);
8407
+ },
8402
8408
  'call.rejected': (e) => this.updateFromCallResponse(e.call),
8403
8409
  'call.ring': (e) => this.updateFromCallResponse(e.call),
8404
8410
  'call.live_started': (e) => this.updateFromCallResponse(e.call),
@@ -8411,8 +8417,8 @@ class CallState {
8411
8417
  },
8412
8418
  'call.recording_started': () => this.setCurrentValue(this.recordingSubject, true),
8413
8419
  'call.recording_stopped': () => this.setCurrentValue(this.recordingSubject, false),
8414
- 'call.broadcasting_started': this.updateFromBroadcastStarted,
8415
- 'call.broadcasting_stopped': this.updateFromBroadcastStopped,
8420
+ 'call.hls_broadcasting_started': this.updateFromHLSBroadcastStarted,
8421
+ 'call.hls_broadcasting_stopped': this.updateFromHLSBroadcastStopped,
8416
8422
  'call.session_participant_joined': this.updateFromSessionParticipantJoined,
8417
8423
  'call.session_participant_left': this.updateFromSessionParticipantLeft,
8418
8424
  'call.blocked_user': this.blockUser,
@@ -8596,6 +8602,12 @@ class CallState {
8596
8602
  get endedBy() {
8597
8603
  return this.getCurrentValue(this.endedBy$);
8598
8604
  }
8605
+ /**
8606
+ * Will provide the thumbnails of this call, if enabled in the call settings.
8607
+ */
8608
+ get thumbnails() {
8609
+ return this.getCurrentValue(this.thumbnails$);
8610
+ }
8599
8611
  }
8600
8612
 
8601
8613
  /**
@@ -11869,6 +11881,32 @@ class Call {
11869
11881
  unbind();
11870
11882
  };
11871
11883
  };
11884
+ /**
11885
+ * Binds a DOM <img> element to this call's thumbnail (if enabled in settings).
11886
+ *
11887
+ * @param imageElement the image element to bind to.
11888
+ * @param opts options for the binding.
11889
+ */
11890
+ this.bindCallThumbnailElement = (imageElement, opts = {}) => {
11891
+ const handleError = () => {
11892
+ imageElement.src =
11893
+ opts.fallbackImageSource ||
11894
+ 'https://getstream.io/random_svg/?name=x&id=x';
11895
+ };
11896
+ const unsubscribe = createSubscription(this.state.thumbnails$, (thumbnails) => {
11897
+ if (!thumbnails)
11898
+ return;
11899
+ imageElement.addEventListener('error', handleError);
11900
+ const thumbnailUrl = new URL(thumbnails.image_url);
11901
+ thumbnailUrl.searchParams.set('w', String(imageElement.clientWidth));
11902
+ thumbnailUrl.searchParams.set('h', String(imageElement.clientHeight));
11903
+ imageElement.src = thumbnailUrl.toString();
11904
+ });
11905
+ return () => {
11906
+ unsubscribe();
11907
+ imageElement.removeEventListener('error', handleError);
11908
+ };
11909
+ };
11872
11910
  this.type = type;
11873
11911
  this.id = id;
11874
11912
  this.cid = `${type}:${id}`;
@@ -13204,7 +13242,7 @@ class WSConnectionFallback {
13204
13242
  }
13205
13243
  }
13206
13244
 
13207
- const version = '0.3.25';
13245
+ const version = '0.3.26';
13208
13246
 
13209
13247
  const logger = getLogger(['location']);
13210
13248
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -14202,11 +14240,11 @@ exports.DynascaleManager = DynascaleManager;
14202
14240
  exports.ErrorFromResponse = ErrorFromResponse;
14203
14241
  exports.InputMediaDeviceManager = InputMediaDeviceManager;
14204
14242
  exports.InputMediaDeviceManagerState = InputMediaDeviceManagerState;
14243
+ exports.LayoutSettingsNameEnum = LayoutSettingsNameEnum;
14244
+ exports.LayoutSettingsRequestNameEnum = LayoutSettingsRequestNameEnum;
14205
14245
  exports.MicrophoneManager = MicrophoneManager;
14206
14246
  exports.MicrophoneManagerState = MicrophoneManagerState;
14207
14247
  exports.OwnCapability = OwnCapability;
14208
- exports.RecordSettingsModeEnum = RecordSettingsModeEnum;
14209
- exports.RecordSettingsQualityEnum = RecordSettingsQualityEnum;
14210
14248
  exports.RecordSettingsRequestModeEnum = RecordSettingsRequestModeEnum;
14211
14249
  exports.RecordSettingsRequestQualityEnum = RecordSettingsRequestQualityEnum;
14212
14250
  exports.RxUtils = rxUtils;