@stream-io/video-client 1.13.1 → 1.15.0

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.browser.es.js +1704 -1762
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +1706 -1780
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +1704 -1762
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/Call.d.ts +61 -30
  9. package/dist/src/StreamSfuClient.d.ts +4 -5
  10. package/dist/src/devices/CameraManager.d.ts +5 -8
  11. package/dist/src/devices/InputMediaDeviceManager.d.ts +5 -5
  12. package/dist/src/devices/MicrophoneManager.d.ts +7 -2
  13. package/dist/src/devices/ScreenShareManager.d.ts +1 -2
  14. package/dist/src/gen/coordinator/index.d.ts +904 -515
  15. package/dist/src/gen/video/sfu/event/events.d.ts +38 -19
  16. package/dist/src/gen/video/sfu/models/models.d.ts +76 -9
  17. package/dist/src/helpers/array.d.ts +7 -0
  18. package/dist/src/permissions/PermissionsContext.d.ts +6 -0
  19. package/dist/src/rtc/BasePeerConnection.d.ts +90 -0
  20. package/dist/src/rtc/Dispatcher.d.ts +0 -1
  21. package/dist/src/rtc/IceTrickleBuffer.d.ts +3 -2
  22. package/dist/src/rtc/Publisher.d.ts +32 -86
  23. package/dist/src/rtc/Subscriber.d.ts +4 -56
  24. package/dist/src/rtc/TransceiverCache.d.ts +55 -0
  25. package/dist/src/rtc/codecs.d.ts +1 -15
  26. package/dist/src/rtc/helpers/sdp.d.ts +8 -0
  27. package/dist/src/rtc/helpers/tracks.d.ts +1 -0
  28. package/dist/src/rtc/index.d.ts +3 -0
  29. package/dist/src/rtc/videoLayers.d.ts +11 -25
  30. package/dist/src/stats/{stateStoreStatsReporter.d.ts → CallStateStatsReporter.d.ts} +5 -1
  31. package/dist/src/stats/SfuStatsReporter.d.ts +4 -2
  32. package/dist/src/stats/index.d.ts +1 -1
  33. package/dist/src/stats/types.d.ts +8 -0
  34. package/dist/src/store/CallState.d.ts +47 -5
  35. package/dist/src/store/rxUtils.d.ts +15 -1
  36. package/dist/src/types.d.ts +26 -22
  37. package/package.json +1 -1
  38. package/src/Call.ts +310 -271
  39. package/src/StreamSfuClient.ts +9 -14
  40. package/src/StreamVideoClient.ts +1 -1
  41. package/src/__tests__/Call.publishing.test.ts +306 -0
  42. package/src/devices/CameraManager.ts +33 -16
  43. package/src/devices/InputMediaDeviceManager.ts +36 -27
  44. package/src/devices/MicrophoneManager.ts +29 -8
  45. package/src/devices/ScreenShareManager.ts +6 -8
  46. package/src/devices/__tests__/CameraManager.test.ts +111 -14
  47. package/src/devices/__tests__/InputMediaDeviceManager.test.ts +4 -4
  48. package/src/devices/__tests__/MicrophoneManager.test.ts +59 -21
  49. package/src/devices/__tests__/ScreenShareManager.test.ts +5 -5
  50. package/src/devices/__tests__/mocks.ts +1 -0
  51. package/src/events/__tests__/internal.test.ts +132 -0
  52. package/src/events/__tests__/mutes.test.ts +0 -3
  53. package/src/events/__tests__/speaker.test.ts +92 -0
  54. package/src/events/participant.ts +3 -4
  55. package/src/gen/coordinator/index.ts +902 -514
  56. package/src/gen/video/sfu/event/events.ts +91 -30
  57. package/src/gen/video/sfu/models/models.ts +105 -13
  58. package/src/helpers/array.ts +14 -0
  59. package/src/permissions/PermissionsContext.ts +22 -0
  60. package/src/permissions/__tests__/PermissionsContext.test.ts +40 -0
  61. package/src/rpc/__tests__/createClient.test.ts +38 -0
  62. package/src/rpc/createClient.ts +11 -5
  63. package/src/rtc/BasePeerConnection.ts +240 -0
  64. package/src/rtc/Dispatcher.ts +0 -9
  65. package/src/rtc/IceTrickleBuffer.ts +24 -4
  66. package/src/rtc/Publisher.ts +210 -528
  67. package/src/rtc/Subscriber.ts +26 -200
  68. package/src/rtc/TransceiverCache.ts +120 -0
  69. package/src/rtc/__tests__/Publisher.test.ts +407 -210
  70. package/src/rtc/__tests__/Subscriber.test.ts +88 -36
  71. package/src/rtc/__tests__/mocks/webrtc.mocks.ts +22 -2
  72. package/src/rtc/__tests__/videoLayers.test.ts +161 -54
  73. package/src/rtc/codecs.ts +1 -131
  74. package/src/rtc/helpers/__tests__/rtcConfiguration.test.ts +34 -0
  75. package/src/rtc/helpers/__tests__/sdp.test.ts +59 -0
  76. package/src/rtc/helpers/sdp.ts +30 -0
  77. package/src/rtc/helpers/tracks.ts +3 -0
  78. package/src/rtc/index.ts +4 -0
  79. package/src/rtc/videoLayers.ts +68 -76
  80. package/src/stats/{stateStoreStatsReporter.ts → CallStateStatsReporter.ts} +58 -27
  81. package/src/stats/SfuStatsReporter.ts +31 -3
  82. package/src/stats/index.ts +1 -1
  83. package/src/stats/types.ts +12 -0
  84. package/src/store/CallState.ts +115 -5
  85. package/src/store/__tests__/CallState.test.ts +101 -0
  86. package/src/store/rxUtils.ts +23 -1
  87. package/src/types.ts +27 -22
  88. package/dist/src/helpers/sdp-munging.d.ts +0 -24
  89. package/dist/src/rtc/bitrateLookup.d.ts +0 -2
  90. package/dist/src/rtc/helpers/iceCandidate.d.ts +0 -2
  91. package/src/helpers/__tests__/hq-audio-sdp.ts +0 -332
  92. package/src/helpers/__tests__/sdp-munging.test.ts +0 -283
  93. package/src/helpers/sdp-munging.ts +0 -265
  94. package/src/rtc/__tests__/bitrateLookup.test.ts +0 -12
  95. package/src/rtc/__tests__/codecs.test.ts +0 -145
  96. package/src/rtc/bitrateLookup.ts +0 -61
  97. package/src/rtc/helpers/iceCandidate.ts +0 -16
  98. /package/dist/src/{compatibility.d.ts → helpers/compatibility.d.ts} +0 -0
  99. /package/src/{compatibility.ts → helpers/compatibility.ts} +0 -0
@@ -0,0 +1,55 @@
1
+ import { PublishOption, TrackType } from '../gen/video/sfu/models/models';
2
+ import { OptimalVideoLayer } from './videoLayers';
3
+ type TransceiverId = {
4
+ publishOption: PublishOption;
5
+ transceiver: RTCRtpTransceiver;
6
+ };
7
+ export declare class TransceiverCache {
8
+ private readonly cache;
9
+ private readonly layers;
10
+ /**
11
+ * An array maintaining the order how transceivers were added to the peer connection.
12
+ * This is needed because some browsers (Firefox) don't reliably report
13
+ * trackId and `mid` parameters.
14
+ */
15
+ private readonly transceiverOrder;
16
+ /**
17
+ * Adds a transceiver to the cache.
18
+ */
19
+ add: (publishOption: PublishOption, transceiver: RTCRtpTransceiver) => void;
20
+ /**
21
+ * Gets the transceiver for the given publish option.
22
+ */
23
+ get: (publishOption: PublishOption) => RTCRtpTransceiver | undefined;
24
+ /**
25
+ * Gets the last transceiver for the given track type and publish option id.
26
+ */
27
+ getWith: (trackType: TrackType, id: number) => RTCRtpTransceiver | undefined;
28
+ /**
29
+ * Checks if the cache has the given publish option.
30
+ */
31
+ has: (publishOption: PublishOption) => boolean;
32
+ /**
33
+ * Finds the first transceiver that satisfies the given predicate.
34
+ */
35
+ find: (predicate: (item: TransceiverId) => boolean) => TransceiverId | undefined;
36
+ /**
37
+ * Provides all the items in the cache.
38
+ */
39
+ items: () => TransceiverId[];
40
+ /**
41
+ * Init index of the transceiver in the cache.
42
+ */
43
+ indexOf: (transceiver: RTCRtpTransceiver) => number;
44
+ /**
45
+ * Gets cached video layers for the given track.
46
+ */
47
+ getLayers: (publishOption: PublishOption) => OptimalVideoLayer[] | undefined;
48
+ /**
49
+ * Sets the video layers for the given track.
50
+ */
51
+ setLayers: (publishOption: PublishOption, layers?: OptimalVideoLayer[]) => void;
52
+ private findTransceiver;
53
+ private findLayer;
54
+ }
55
+ export {};
@@ -1,25 +1,11 @@
1
- import type { PreferredCodec } from '../types';
2
- /**
3
- * Returns back a list of sorted codecs, with the preferred codec first.
4
- *
5
- * @param kind the kind of codec to get.
6
- * @param preferredCodec the codec to prioritize (vp8, h264, vp9, av1...).
7
- * @param codecToRemove the codec to exclude from the list.
8
- * @param codecPreferencesSource the source of the codec preferences.
9
- */
10
- export declare const getPreferredCodecs: (kind: "audio" | "video", preferredCodec: string, codecToRemove: string | undefined, codecPreferencesSource: "sender" | "receiver") => RTCRtpCodec[] | undefined;
11
1
  /**
12
2
  * Returns a generic SDP for the given direction.
13
3
  * We use this SDP to send it as part of our JoinRequest so that the SFU
14
- * can use it to determine client's codec capabilities.
4
+ * can use it to determine the client's codec capabilities.
15
5
  *
16
6
  * @param direction the direction of the transceiver.
17
7
  */
18
8
  export declare const getGenericSdp: (direction: RTCRtpTransceiverDirection) => Promise<string>;
19
- /**
20
- * Returns the optimal video codec for the device.
21
- */
22
- export declare const getOptimalVideoCodec: (preferredCodec: PreferredCodec | undefined) => PreferredCodec;
23
9
  /**
24
10
  * Returns whether the codec is an SVC codec.
25
11
  *
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Extracts the mid from the transceiver or the SDP.
3
+ *
4
+ * @param transceiver the transceiver.
5
+ * @param transceiverInitIndex the index of the transceiver in the transceiver's init array.
6
+ * @param sdp the SDP.
7
+ */
8
+ export declare const extractMid: (transceiver: RTCRtpTransceiver, transceiverInitIndex: number, sdp: string | undefined) => string;
@@ -3,3 +3,4 @@ import { TrackMuteType } from '../../types';
3
3
  export declare const trackTypeToParticipantStreamKey: (trackType: TrackType) => "audioStream" | "videoStream" | "screenShareStream" | "screenShareAudioStream" | undefined;
4
4
  export declare const muteTypeToTrackType: (muteType: TrackMuteType) => TrackType | undefined;
5
5
  export declare const toTrackType: (trackType: string) => TrackType | undefined;
6
+ export declare const isAudioTrackType: (trackType: TrackType) => boolean;
@@ -5,3 +5,6 @@ export * from './Publisher';
5
5
  export * from './Subscriber';
6
6
  export * from './signal';
7
7
  export * from './videoLayers';
8
+ export * from './helpers/sdp';
9
+ export * from './helpers/tracks';
10
+ export * from './helpers/rtcConfiguration';
@@ -1,6 +1,4 @@
1
- import { PreferredCodec, PublishOptions } from '../types';
2
- import { TargetResolutionResponse } from '../gen/shims';
3
- import { VideoQuality } from '../gen/video/sfu/models/models';
1
+ import { PublishOption, VideoDimension, VideoLayer, VideoQuality } from '../gen/video/sfu/models/models';
4
2
  export type OptimalVideoLayer = RTCRtpEncodingParameters & {
5
3
  width: number;
6
4
  height: number;
@@ -13,32 +11,22 @@ export type OptimalVideoLayer = RTCRtpEncodingParameters & {
13
11
  *
14
12
  * @param layers the layers to process.
15
13
  */
16
- export declare const toSvcEncodings: (layers: OptimalVideoLayer[] | undefined) => {
17
- rid: string;
18
- active?: boolean;
19
- maxBitrate?: number;
20
- maxFramerate?: number;
21
- networkPriority?: RTCPriorityType;
22
- priority?: RTCPriorityType;
23
- scaleResolutionDownBy?: number;
24
- width: number;
25
- height: number;
26
- scalabilityMode?: string;
27
- }[] | undefined;
14
+ export declare const toSvcEncodings: (layers: OptimalVideoLayer[] | undefined) => RTCRtpEncodingParameters[] | undefined;
28
15
  /**
29
16
  * Converts the rid to a video quality.
30
17
  */
31
18
  export declare const ridToVideoQuality: (rid: string) => VideoQuality;
32
19
  /**
33
- * Determines the most optimal video layers for simulcasting
34
- * for the given track.
20
+ * Converts the given video layers to SFU video layers.
21
+ */
22
+ export declare const toVideoLayers: (layers?: OptimalVideoLayer[] | undefined) => VideoLayer[];
23
+ /**
24
+ * Determines the most optimal video layers for the given track.
35
25
  *
36
26
  * @param videoTrack the video track to find optimal layers for.
37
- * @param targetResolution the expected target resolution.
38
- * @param codecInUse the codec in use.
39
- * @param publishOptions the publish options for the track.
27
+ * @param publishOption the publish options for the track.
40
28
  */
41
- export declare const findOptimalVideoLayers: (videoTrack: MediaStreamTrack, targetResolution?: TargetResolutionResponse, codecInUse?: PreferredCodec, publishOptions?: PublishOptions) => OptimalVideoLayer[];
29
+ export declare const computeVideoLayers: (videoTrack: MediaStreamTrack, publishOption: PublishOption) => OptimalVideoLayer[] | undefined;
42
30
  /**
43
31
  * Computes the maximum bitrate for a given resolution.
44
32
  * If the current resolution is lower than the target resolution,
@@ -49,8 +37,6 @@ export declare const findOptimalVideoLayers: (videoTrack: MediaStreamTrack, targ
49
37
  * @param targetResolution the target resolution.
50
38
  * @param currentWidth the current width of the track.
51
39
  * @param currentHeight the current height of the track.
52
- * @param codecInUse the codec in use.
53
- * @param publishOptions the publish options.
40
+ * @param bitrate the target bitrate.
54
41
  */
55
- export declare const getComputedMaxBitrate: (targetResolution: TargetResolutionResponse, currentWidth: number, currentHeight: number, codecInUse?: PreferredCodec, publishOptions?: PublishOptions) => number;
56
- export declare const findOptimalScreenSharingLayers: (videoTrack: MediaStreamTrack, publishOptions?: PublishOptions, defaultMaxBitrate?: number) => OptimalVideoLayer[];
42
+ export declare const getComputedMaxBitrate: (targetResolution: VideoDimension, currentWidth: number, currentHeight: number, bitrate: number) => number;
@@ -28,7 +28,7 @@ export type StatsReporter = {
28
28
  * @param kind the peer connection kind (subscriber or publisher).
29
29
  * @param mediaStream the media stream.
30
30
  */
31
- getStatsForStream: (kind: 'subscriber' | 'publisher', mediaStream: MediaStream) => Promise<StatsReport[]>;
31
+ getStatsForStream: (kind: 'subscriber' | 'publisher', tracks: MediaStreamTrack[]) => Promise<StatsReport[]>;
32
32
  /**
33
33
  * Helper method for retrieving raw stats for a given peer connection kind.
34
34
  *
@@ -54,4 +54,8 @@ export type StatsTransformOpts = {
54
54
  * The kind of peer connection we are transforming stats for.
55
55
  */
56
56
  kind: 'subscriber' | 'publisher';
57
+ /**
58
+ * The publisher instance.
59
+ */
60
+ publisher: Publisher | undefined;
57
61
  };
@@ -2,9 +2,9 @@ import { StreamSfuClient } from '../StreamSfuClient';
2
2
  import { StatsOptions } from '../gen/coordinator';
3
3
  import { Publisher, Subscriber } from '../rtc';
4
4
  import { LocalClientDetailsType } from '../client-details';
5
+ import { WebsocketReconnectStrategy } from '../gen/video/sfu/models/models';
5
6
  import { CameraManager, MicrophoneManager } from '../devices';
6
7
  import { CallState } from '../store';
7
- import { Telemetry } from '../gen/video/sfu/signal_rpc/signal';
8
8
  export type SfuStatsReporterOptions = {
9
9
  options: StatsOptions;
10
10
  clientDetails: LocalClientDetailsType;
@@ -32,7 +32,9 @@ export declare class SfuStatsReporter {
32
32
  private readonly inputDevices;
33
33
  constructor(sfuClient: StreamSfuClient, { options, clientDetails, subscriber, publisher, microphone, camera, state, }: SfuStatsReporterOptions);
34
34
  private observeDevice;
35
- sendTelemetryData: (telemetryData: Telemetry) => Promise<void>;
35
+ sendConnectionTime: (connectionTimeSeconds: number) => void;
36
+ sendReconnectionTime: (strategy: WebsocketReconnectStrategy, timeSeconds: number) => void;
37
+ private sendTelemetryData;
36
38
  private run;
37
39
  start: () => void;
38
40
  stop: () => void;
@@ -1,3 +1,3 @@
1
- export * from './stateStoreStatsReporter';
1
+ export * from './CallStateStatsReporter';
2
2
  export * from './SfuStatsReporter';
3
3
  export * from './types';
@@ -1,3 +1,4 @@
1
+ import { TrackType } from '../gen/video/sfu/models/models';
1
2
  export type BaseStats = {
2
3
  audioLevel?: number;
3
4
  bytesSent?: number;
@@ -9,9 +10,11 @@ export type BaseStats = {
9
10
  framesPerSecond?: number;
10
11
  jitter?: number;
11
12
  kind?: string;
13
+ mediaSourceId?: string;
12
14
  qualityLimitationReason?: string;
13
15
  rid?: string;
14
16
  ssrc?: number;
17
+ trackType?: TrackType;
15
18
  };
16
19
  export type StatsReport = {
17
20
  rawStats?: RTCStatsReport;
@@ -28,6 +31,7 @@ export type AggregatedStatsReport = {
28
31
  highestFrameHeight: number;
29
32
  highestFramesPerSecond: number;
30
33
  codec: string;
34
+ codecPerTrackType: Partial<Record<TrackType, string>>;
31
35
  timestamp: number;
32
36
  rawReport: StatsReport;
33
37
  };
@@ -43,3 +47,7 @@ export type CallStatsReport = {
43
47
  participants: ParticipantsStatsReport;
44
48
  timestamp: number;
45
49
  };
50
+ export interface RTCMediaSourceStats {
51
+ kind: string;
52
+ trackIdentifier: string;
53
+ }
@@ -1,9 +1,9 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import type { Patch } from './rxUtils';
3
3
  import { CallingState } from './CallingState';
4
- import { type StreamVideoParticipant, type StreamVideoParticipantPatch, type StreamVideoParticipantPatches, type SubscriptionChanges, VideoTrackType } from '../types';
4
+ import { type ClosedCaptionsSettings, type StreamVideoParticipant, type StreamVideoParticipantPatch, type StreamVideoParticipantPatches, type SubscriptionChanges, VideoTrackType } from '../types';
5
5
  import { CallStatsReport } from '../stats';
6
- import { CallIngressResponse, CallResponse, CallSessionResponse, CallSettingsResponse, EgressResponse, MemberResponse, OwnCapability, ThumbnailResponse, UserResponse, WSEvent } from '../gen/coordinator';
6
+ import { CallClosedCaption, CallIngressResponse, CallResponse, CallSessionResponse, CallSettingsResponse, EgressResponse, MemberResponse, OwnCapability, ThumbnailResponse, UserResponse, WSEvent } from '../gen/coordinator';
7
7
  import { ReconnectDetails } from '../gen/video/sfu/event/events';
8
8
  import { CallState as SfuCallState, Pin, TrackType } from '../gen/video/sfu/models/models';
9
9
  import { Comparator } from '../sorting';
@@ -32,6 +32,7 @@ export declare class CallState {
32
32
  private sessionSubject;
33
33
  private settingsSubject;
34
34
  private transcribingSubject;
35
+ private captioningSubject;
35
36
  private endedBySubject;
36
37
  private thumbnailsSubject;
37
38
  private membersSubject;
@@ -42,6 +43,7 @@ export declare class CallState {
42
43
  private anonymousParticipantCountSubject;
43
44
  private participantsSubject;
44
45
  private callStatsReportSubject;
46
+ private closedCaptionsSubject;
45
47
  private orphanedTracks;
46
48
  /**
47
49
  * The time the call session actually started.
@@ -165,6 +167,10 @@ export declare class CallState {
165
167
  * Will provide the transcribing state of this call.
166
168
  */
167
169
  transcribing$: Observable<boolean>;
170
+ /**
171
+ * Will provide the closed captioning state of this call.
172
+ */
173
+ captioning$: Observable<boolean>;
168
174
  /**
169
175
  * Will provide the user who ended this call.
170
176
  */
@@ -173,19 +179,30 @@ export declare class CallState {
173
179
  * Will provide the thumbnails of this call.
174
180
  */
175
181
  thumbnails$: Observable<ThumbnailResponse | undefined>;
182
+ /**
183
+ * The queue of closed captions.
184
+ */
185
+ closedCaptions$: Observable<CallClosedCaption[]>;
176
186
  readonly logger: import("../..").Logger;
177
187
  /**
178
188
  * A list of comparators that are used to sort the participants.
179
- *
180
- * @private
181
189
  */
182
190
  private sortParticipantsBy;
191
+ /**
192
+ * The closed captions configuration.
193
+ */
194
+ private closedCaptionsSettings;
195
+ private closedCaptionsTasks;
183
196
  private readonly eventHandlers;
184
197
  /**
185
198
  * Creates a new instance of the CallState class.
186
199
  *
187
200
  */
188
201
  constructor();
202
+ /**
203
+ * Runs the cleanup tasks.
204
+ */
205
+ dispose: () => void;
189
206
  /**
190
207
  * Sets the list of criteria that are used to sort the participants.
191
208
  * To disable sorting, you can pass `noopComparator()`.
@@ -236,6 +253,21 @@ export declare class CallState {
236
253
  * @param startedAt the time the call session actually started.
237
254
  */
238
255
  setStartedAt: (startedAt: Patch<Date | undefined>) => Date | undefined;
256
+ /**
257
+ * Returns whether closed captions are enabled in the current call.
258
+ */
259
+ get captioning(): boolean;
260
+ /**
261
+ * Sets the closed captioning state of the current call.
262
+ *
263
+ * @internal
264
+ * @param captioning the closed captioning state.
265
+ */
266
+ setCaptioning: (captioning: boolean) => {
267
+ lastValue: boolean;
268
+ value: boolean;
269
+ rollback: () => boolean;
270
+ };
239
271
  /**
240
272
  * The server-side counted number of anonymous participants connected to the current call.
241
273
  * This number includes the anonymous participants as well.
@@ -393,6 +425,10 @@ export declare class CallState {
393
425
  * Will provide the thumbnails of this call, if enabled in the call settings.
394
426
  */
395
427
  get thumbnails(): ThumbnailResponse | undefined;
428
+ /**
429
+ * Returns the current queue of closed captions.
430
+ */
431
+ get closedCaptions(): CallClosedCaption[];
396
432
  /**
397
433
  * Will try to find the participant with the given sessionId in the current call.
398
434
  *
@@ -443,7 +479,6 @@ export declare class CallState {
443
479
  *
444
480
  * @param trackType the kind of subscription to update.
445
481
  * @param changes the list of subscription changes to do.
446
- * @param type the debounce type to use for the update.
447
482
  */
448
483
  updateParticipantTracks: (trackType: VideoTrackType, changes: SubscriptionChanges) => StreamVideoParticipant[];
449
484
  /**
@@ -485,6 +520,12 @@ export declare class CallState {
485
520
  * @param trackLookupPrefix the track lookup prefix to match the orphaned tracks by.
486
521
  */
487
522
  takeOrphanedTracks: (trackLookupPrefix: string) => OrphanedTrack[];
523
+ /**
524
+ * Updates the closed captions settings.
525
+ *
526
+ * @param config the new closed captions settings.
527
+ */
528
+ updateClosedCaptionSettings: (config: Partial<ClosedCaptionsSettings>) => void;
488
529
  /**
489
530
  * Updates the call state with the data received from the server.
490
531
  *
@@ -517,5 +558,6 @@ export declare class CallState {
517
558
  private unblockUser;
518
559
  private blockUser;
519
560
  private updateOwnCapabilities;
561
+ private updateFromClosedCaptions;
520
562
  }
521
563
  export {};
@@ -1,4 +1,4 @@
1
- import { Observable, Subject } from 'rxjs';
1
+ import { BehaviorSubject, Observable, Subject } from 'rxjs';
2
2
  type FunctionPatch<T> = (currentValue: T) => T;
3
3
  /**
4
4
  * A value or a function which takes the current value and returns a new value.
@@ -21,6 +21,20 @@ export declare const getCurrentValue: <T>(observable$: Observable<T>) => T;
21
21
  * @return the updated value.
22
22
  */
23
23
  export declare const setCurrentValue: <T>(subject: Subject<T>, update: Patch<T>) => T;
24
+ /**
25
+ * Updates the value of the provided Subject and returns the previous value
26
+ * and a function to roll back the update.
27
+ * This is useful when you want to optimistically update a value
28
+ * and roll back the update if an error occurs.
29
+ *
30
+ * @param subject the subject to update.
31
+ * @param update the update to apply to the subject.
32
+ */
33
+ export declare const updateValue: <T>(subject: BehaviorSubject<T>, update: Patch<T>) => {
34
+ lastValue: T;
35
+ value: T;
36
+ rollback: () => T;
37
+ };
24
38
  /**
25
39
  * Creates a subscription and returns a function to unsubscribe.
26
40
  *
@@ -89,6 +89,20 @@ export type ParticipantPin = {
89
89
  */
90
90
  pinnedAt: number;
91
91
  };
92
+ export type ClosedCaptionsSettings = {
93
+ /**
94
+ * The time in milliseconds to keep a closed caption in the state (visible).
95
+ * Default is 2700 ms.
96
+ */
97
+ visibilityDurationMs?: number;
98
+ /**
99
+ * The maximum number of closed captions to keep in the state (visible).
100
+ * When the maximum number is reached, the oldest closed caption is removed.
101
+ *
102
+ * Default is 2.
103
+ */
104
+ maxVisibleCaptions?: number;
105
+ };
92
106
  /**
93
107
  * A partial representation of the StreamVideoParticipant.
94
108
  */
@@ -110,7 +124,7 @@ export type SubscriptionChanges = {
110
124
  [sessionId: string]: SubscriptionChange;
111
125
  };
112
126
  /**
113
- * A preferred codec to use when publishing a video track.
127
+ * A preferred codec to use when publishing a video or audio track.
114
128
  * @internal
115
129
  */
116
130
  export type PreferredCodec = 'vp8' | 'h264' | 'vp9' | 'av1';
@@ -118,41 +132,31 @@ export type PreferredCodec = 'vp8' | 'h264' | 'vp9' | 'av1';
118
132
  * A collection of track publication options.
119
133
  * @internal
120
134
  */
121
- export type PublishOptions = {
135
+ export type ClientPublishOptions = {
122
136
  /**
123
137
  * The preferred codec to use when publishing the video stream.
124
138
  */
125
139
  preferredCodec?: PreferredCodec;
126
140
  /**
127
- * Force the codec to use when publishing the video stream.
128
- * This will override the preferred codec and the internal codec selection logic.
129
- * Use with caution.
130
- */
131
- forceCodec?: PreferredCodec;
132
- /**
133
- * When using a preferred codec, force the use of a single codec.
134
- * Enabling this, it will remove all other supported codecs from the SDP.
135
- * Defaults to false.
141
+ * The fmtp line for the video codec.
136
142
  */
137
- forceSingleCodec?: boolean;
138
- /**
139
- * The preferred scalability to use when publishing the video stream.
140
- * Applicable only for SVC codecs.
141
- */
142
- scalabilityMode?: string;
143
+ fmtpLine?: string;
143
144
  /**
144
145
  * The preferred bitrate to use when publishing the video stream.
145
146
  */
146
147
  preferredBitrate?: number;
147
- /**
148
- * The preferred downscale factor to use when publishing the video stream
149
- * in simulcast mode (non-SVC).
150
- */
151
- bitrateDownscaleFactor?: number;
152
148
  /**
153
149
  * The maximum number of simulcast layers to use when publishing the video stream.
154
150
  */
155
151
  maxSimulcastLayers?: number;
152
+ /**
153
+ * The preferred subscription (incoming video stream) codec.
154
+ */
155
+ subscriberCodec?: PreferredCodec;
156
+ /**
157
+ * The fmtp line for the subscriber codec.
158
+ */
159
+ subscriberFmtpLine?: string;
156
160
  /**
157
161
  * Screen share settings.
158
162
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.13.1",
3
+ "version": "1.15.0",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",