@stream-io/video-client 0.3.24 → 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.
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,11 @@ export declare const defaultSortPreset: import("./comparator").Comparator<Stream
7
7
  * The sorting preset for speaker layout.
8
8
  */
9
9
  export declare const speakerLayoutSortPreset: import("./comparator").Comparator<StreamVideoParticipant>;
10
+ /**
11
+ * The sorting preset for layouts that don't render all participants but
12
+ * instead, render them in pages.
13
+ */
14
+ export declare const paginatedLayoutSortPreset: import("./comparator").Comparator<StreamVideoParticipant>;
10
15
  /**
11
16
  * The sorting preset for livestreams and audio rooms.
12
17
  */
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
2
2
  import type { Patch } from './rxUtils';
3
3
  import { StreamVideoLocalParticipant, StreamVideoParticipant, StreamVideoParticipantPatch, StreamVideoParticipantPatches } from '../types';
4
4
  import { CallStatsReport } from '../stats/types';
5
- import { CallIngressResponse, CallResponse, CallSessionResponse, CallSettingsResponse, EgressResponse, MemberResponse, OwnCapability, UserResponse, VideoEvent } from '../gen/coordinator';
5
+ import { CallIngressResponse, CallResponse, CallSessionResponse, CallSettingsResponse, EgressResponse, MemberResponse, OwnCapability, ThumbnailResponse, UserResponse, VideoEvent } from '../gen/coordinator';
6
6
  import { Pin } from '../gen/video/sfu/models/models';
7
7
  import { Comparator } from '../sorting';
8
8
  import { Logger } from '../coordinator/connection/types';
@@ -72,6 +72,7 @@ export declare class CallState {
72
72
  private settingsSubject;
73
73
  private transcribingSubject;
74
74
  private endedBySubject;
75
+ private thumbnailsSubject;
75
76
  private membersSubject;
76
77
  private ownCapabilitiesSubject;
77
78
  private callingStateSubject;
@@ -206,6 +207,10 @@ export declare class CallState {
206
207
  * Will provide the user who ended this call.
207
208
  */
208
209
  endedBy$: Observable<UserResponse | undefined>;
210
+ /**
211
+ * Will provide the thumbnails of this call.
212
+ */
213
+ thumbnails$: Observable<ThumbnailResponse | undefined>;
209
214
  readonly logger: Logger;
210
215
  /**
211
216
  * A list of comparators that are used to sort the participants.
@@ -417,6 +422,10 @@ export declare class CallState {
417
422
  * Will provide the user who ended this call.
418
423
  */
419
424
  get endedBy(): UserResponse | undefined;
425
+ /**
426
+ * Will provide the thumbnails of this call, if enabled in the call settings.
427
+ */
428
+ get thumbnails(): ThumbnailResponse | undefined;
420
429
  /**
421
430
  * Will try to find the participant with the given sessionId in the current call.
422
431
  *
@@ -484,8 +493,8 @@ export declare class CallState {
484
493
  updateFromCallResponse: (call: CallResponse) => void;
485
494
  private updateFromMemberRemoved;
486
495
  private updateFromMemberAdded;
487
- private updateFromBroadcastStopped;
488
- private updateFromBroadcastStarted;
496
+ private updateFromHLSBroadcastStopped;
497
+ private updateFromHLSBroadcastStarted;
489
498
  private updateFromSessionParticipantLeft;
490
499
  private updateFromSessionParticipantJoined;
491
500
  private updateMembers;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.3.24";
1
+ export declare const version = "0.3.26";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -44,7 +44,7 @@
44
44
  "ws": "^8.13.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@openapitools/openapi-generator-cli": "^2.6.0",
47
+ "@openapitools/openapi-generator-cli": "^2.7.0",
48
48
  "@rollup/plugin-replace": "^5.0.2",
49
49
  "@rollup/plugin-typescript": "^11.1.2",
50
50
  "@types/jsonwebtoken": "^9.0.1",
package/src/Call.ts CHANGED
@@ -50,9 +50,9 @@ import {
50
50
  SendReactionRequest,
51
51
  SendReactionResponse,
52
52
  SFUResponse,
53
- StartBroadcastingResponse,
53
+ StartHLSBroadcastingResponse,
54
54
  StartRecordingResponse,
55
- StopBroadcastingResponse,
55
+ StopHLSBroadcastingResponse,
56
56
  StopLiveResponse,
57
57
  StopRecordingResponse,
58
58
  UnblockUserRequest,
@@ -1597,7 +1597,7 @@ export class Call {
1597
1597
  * Starts the broadcasting of the call.
1598
1598
  */
1599
1599
  startHLS = async () => {
1600
- return this.streamClient.post<StartBroadcastingResponse>(
1600
+ return this.streamClient.post<StartHLSBroadcastingResponse>(
1601
1601
  `${this.streamClientBasePath}/start_broadcasting`,
1602
1602
  {},
1603
1603
  );
@@ -1607,7 +1607,7 @@ export class Call {
1607
1607
  * Stops the broadcasting of the call.
1608
1608
  */
1609
1609
  stopHLS = async () => {
1610
- return this.streamClient.post<StopBroadcastingResponse>(
1610
+ return this.streamClient.post<StopHLSBroadcastingResponse>(
1611
1611
  `${this.streamClientBasePath}/stop_broadcasting`,
1612
1612
  {},
1613
1613
  );
@@ -1966,4 +1966,42 @@ export class Call {
1966
1966
  unbind();
1967
1967
  };
1968
1968
  };
1969
+
1970
+ /**
1971
+ * Binds a DOM <img> element to this call's thumbnail (if enabled in settings).
1972
+ *
1973
+ * @param imageElement the image element to bind to.
1974
+ * @param opts options for the binding.
1975
+ */
1976
+ bindCallThumbnailElement = (
1977
+ imageElement: HTMLImageElement,
1978
+ opts: {
1979
+ fallbackImageSource?: string;
1980
+ } = {},
1981
+ ) => {
1982
+ const handleError = () => {
1983
+ imageElement.src =
1984
+ opts.fallbackImageSource ||
1985
+ 'https://getstream.io/random_svg/?name=x&id=x';
1986
+ };
1987
+
1988
+ const unsubscribe = createSubscription(
1989
+ this.state.thumbnails$,
1990
+ (thumbnails) => {
1991
+ if (!thumbnails) return;
1992
+ imageElement.addEventListener('error', handleError);
1993
+
1994
+ const thumbnailUrl = new URL(thumbnails.image_url);
1995
+ thumbnailUrl.searchParams.set('w', String(imageElement.clientWidth));
1996
+ thumbnailUrl.searchParams.set('h', String(imageElement.clientHeight));
1997
+
1998
+ imageElement.src = thumbnailUrl.toString();
1999
+ },
2000
+ );
2001
+
2002
+ return () => {
2003
+ unsubscribe();
2004
+ imageElement.removeEventListener('error', handleError);
2005
+ };
2006
+ };
1969
2007
  }
@@ -5,8 +5,7 @@ import { generateUUIDv4 } from '../../coordinator/connection/utils';
5
5
  import { LogLevel } from '../../coordinator/connection/types';
6
6
  import {
7
7
  OwnCapability,
8
- RecordSettingsModeEnum,
9
- RecordSettingsQualityEnum,
8
+ RecordSettingsRequestModeEnum,
10
9
  } from '../../gen/coordinator';
11
10
 
12
11
  const apiKey = process.env.STREAM_API_KEY!;
@@ -98,10 +97,7 @@ describe('call types CRUD API', () => {
98
97
  settings: {
99
98
  audio: { mic_default_on: false, default_device: 'earpiece' },
100
99
  recording: {
101
- mode: RecordSettingsModeEnum.DISABLED,
102
- // FIXME OL: these props shouldn't be required to be set when recording is disabled
103
- audio_only: false,
104
- quality: RecordSettingsQualityEnum._1080P,
100
+ mode: RecordSettingsRequestModeEnum.DISABLED,
105
101
  },
106
102
  },
107
103
  });
@@ -109,7 +105,7 @@ describe('call types CRUD API', () => {
109
105
  expect(updateResponse.settings.audio.mic_default_on).toBeFalsy();
110
106
  expect(updateResponse.settings.audio.default_device).toBe('earpiece');
111
107
  expect(updateResponse.settings.recording.mode).toBe(
112
- RecordSettingsModeEnum.DISABLED,
108
+ RecordSettingsRequestModeEnum.DISABLED,
113
109
  );
114
110
  });
115
111