@stream-io/video-client 1.4.2 → 1.4.4

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 (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.browser.es.js +246 -154
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +246 -152
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +246 -154
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/Call.d.ts +7 -7
  9. package/dist/src/StreamSfuClient.d.ts +7 -7
  10. package/dist/src/StreamVideoClient.d.ts +5 -5
  11. package/dist/src/coordinator/connection/client.d.ts +13 -14
  12. package/dist/src/coordinator/connection/connection.d.ts +3 -5
  13. package/dist/src/coordinator/connection/insights.d.ts +0 -1
  14. package/dist/src/devices/BrowserPermission.d.ts +24 -0
  15. package/dist/src/devices/InputMediaDeviceManager.d.ts +4 -3
  16. package/dist/src/devices/InputMediaDeviceManagerState.d.ts +3 -3
  17. package/dist/src/devices/MicrophoneManager.d.ts +1 -0
  18. package/dist/src/devices/devices.d.ts +30 -11
  19. package/dist/src/devices/filters.d.ts +32 -0
  20. package/dist/src/helpers/ViewportTracker.d.ts +1 -1
  21. package/dist/src/helpers/lazy.d.ts +4 -0
  22. package/dist/src/helpers/sdp-munging.d.ts +2 -2
  23. package/dist/src/rtc/Dispatcher.d.ts +2 -2
  24. package/dist/src/rtc/codecs.d.ts +1 -1
  25. package/dist/src/rtc/signal.d.ts +0 -1
  26. package/dist/src/stats/utils.d.ts +4 -4
  27. package/dist/src/store/CallState.d.ts +1 -1
  28. package/package.json +4 -4
  29. package/src/devices/BrowserPermission.ts +152 -0
  30. package/src/devices/CameraManagerState.ts +2 -6
  31. package/src/devices/InputMediaDeviceManager.ts +55 -12
  32. package/src/devices/InputMediaDeviceManagerState.ts +10 -44
  33. package/src/devices/MicrophoneManager.ts +6 -4
  34. package/src/devices/MicrophoneManagerState.ts +2 -6
  35. package/src/devices/__tests__/CameraManager.test.ts +3 -0
  36. package/src/devices/__tests__/InputMediaDeviceManager.test.ts +5 -3
  37. package/src/devices/__tests__/InputMediaDeviceManagerFilters.test.ts +13 -8
  38. package/src/devices/__tests__/InputMediaDeviceManagerState.test.ts +41 -51
  39. package/src/devices/__tests__/MicrophoneManager.test.ts +4 -1
  40. package/src/devices/__tests__/MicrophoneManagerRN.test.ts +8 -1
  41. package/src/devices/__tests__/SpeakerManager.test.ts +8 -1
  42. package/src/devices/__tests__/mocks.ts +6 -1
  43. package/src/devices/devices.ts +113 -112
  44. package/src/devices/filters.ts +38 -0
  45. package/src/helpers/RNSpeechDetector.ts +1 -1
  46. package/src/helpers/lazy.ts +15 -0
@@ -7,7 +7,7 @@ import { VideoLayerSetting } from './gen/video/sfu/event/events';
7
7
  import { DynascaleManager } from './helpers/DynascaleManager';
8
8
  import { PermissionsContext } from './permissions';
9
9
  import { StreamClient } from './coordinator/connection/client';
10
- import { CallEventListener, Logger, RejectReason } from './coordinator/connection/types';
10
+ import { AllCallEvents, CallEventListener, Logger, RejectReason } from './coordinator/connection/types';
11
11
  import { CameraManager, MicrophoneManager, ScreenShareManager, SpeakerManager } from './devices';
12
12
  /**
13
13
  * An object representation of a `Call`.
@@ -105,14 +105,14 @@ export declare class Call {
105
105
  * @param eventName the event name.
106
106
  * @param fn the event handler.
107
107
  */
108
- on: <E extends import("./coordinator/connection/types").EventTypes | import("./rtc").SfuEventKinds>(eventName: E, fn: CallEventListener<E>) => () => void;
108
+ on: <E extends keyof AllCallEvents>(eventName: E, fn: CallEventListener<E>) => () => void;
109
109
  /**
110
110
  * Remove subscription for WebSocket events that were created by the `on` method.
111
111
  *
112
112
  * @param eventName the event name.
113
113
  * @param fn the event handler.
114
114
  */
115
- off: <E extends import("./coordinator/connection/types").EventTypes | import("./rtc").SfuEventKinds>(eventName: E, fn: CallEventListener<E>) => void;
115
+ off: <E extends keyof AllCallEvents>(eventName: E, fn: CallEventListener<E>) => void;
116
116
  /**
117
117
  * Leave the call and stop the media streams that were published by the call.
118
118
  */
@@ -248,7 +248,7 @@ export declare class Call {
248
248
  * @param changes the list of subscription changes to do.
249
249
  * @param type the debounce type to use for the update.
250
250
  */
251
- updateSubscriptionsPartial: (trackType: VideoTrackType | 'video' | 'screen', changes: SubscriptionChanges, type?: DebounceType) => void;
251
+ updateSubscriptionsPartial: (trackType: VideoTrackType | "video" | "screen", changes: SubscriptionChanges, type?: DebounceType) => void;
252
252
  private updateSubscriptions;
253
253
  /**
254
254
  * Will enhance the reported stats with additional participant-specific information (`callStatsReport$` state [store variable](./StreamVideoClient.md/#readonlystatestore)).
@@ -450,7 +450,7 @@ export declare class Call {
450
450
  * @param request
451
451
  * @returns
452
452
  */
453
- queryMembers: (request?: Omit<QueryCallMembersRequest, 'type' | 'id'>) => Promise<QueryCallMembersResponse>;
453
+ queryMembers: (request?: Omit<QueryCallMembersRequest, "type" | "id">) => Promise<QueryCallMembersResponse>;
454
454
  /**
455
455
  * Will update the call members.
456
456
  *
@@ -494,8 +494,8 @@ export declare class Call {
494
494
  * @returns
495
495
  */
496
496
  submitFeedback: (rating: number, { reason, custom, }?: {
497
- reason?: string | undefined;
498
- custom?: Record<string, any> | undefined;
497
+ reason?: string;
498
+ custom?: Record<string, any>;
499
499
  }) => Promise<CollectUserFeedbackResponse>;
500
500
  /**
501
501
  * Sends a custom event to all call participants.
@@ -102,16 +102,16 @@ export declare class StreamSfuClient {
102
102
  constructor({ dispatcher, sfuServer, token, sessionId, }: StreamSfuClientConstructor);
103
103
  close: (code: number, reason: string) => void;
104
104
  updateSubscriptions: (subscriptions: TrackSubscriptionDetails[]) => Promise<FinishedUnaryCall<import("./gen/video/sfu/signal_rpc/signal").UpdateSubscriptionsRequest, import("./gen/video/sfu/signal_rpc/signal").UpdateSubscriptionsResponse>>;
105
- setPublisher: (data: Omit<SetPublisherRequest, 'sessionId'>) => Promise<FinishedUnaryCall<SetPublisherRequest, import("./gen/video/sfu/signal_rpc/signal").SetPublisherResponse>>;
106
- sendAnswer: (data: Omit<SendAnswerRequest, 'sessionId'>) => Promise<FinishedUnaryCall<SendAnswerRequest, import("./gen/video/sfu/signal_rpc/signal").SendAnswerResponse>>;
107
- iceTrickle: (data: Omit<ICETrickle, 'sessionId'>) => Promise<FinishedUnaryCall<ICETrickle, import("./gen/video/sfu/signal_rpc/signal").ICETrickleResponse>>;
108
- iceRestart: (data: Omit<ICERestartRequest, 'sessionId'>) => Promise<FinishedUnaryCall<ICERestartRequest, import("./gen/video/sfu/signal_rpc/signal").ICERestartResponse>>;
105
+ setPublisher: (data: Omit<SetPublisherRequest, "sessionId">) => Promise<FinishedUnaryCall<SetPublisherRequest, import("./gen/video/sfu/signal_rpc/signal").SetPublisherResponse>>;
106
+ sendAnswer: (data: Omit<SendAnswerRequest, "sessionId">) => Promise<FinishedUnaryCall<SendAnswerRequest, import("./gen/video/sfu/signal_rpc/signal").SendAnswerResponse>>;
107
+ iceTrickle: (data: Omit<ICETrickle, "sessionId">) => Promise<FinishedUnaryCall<ICETrickle, import("./gen/video/sfu/signal_rpc/signal").ICETrickleResponse>>;
108
+ iceRestart: (data: Omit<ICERestartRequest, "sessionId">) => Promise<FinishedUnaryCall<ICERestartRequest, import("./gen/video/sfu/signal_rpc/signal").ICERestartResponse>>;
109
109
  updateMuteState: (trackType: TrackType, muted: boolean) => Promise<FinishedUnaryCall<UpdateMuteStatesRequest, import("./gen/video/sfu/signal_rpc/signal").UpdateMuteStatesResponse>>;
110
- updateMuteStates: (data: Omit<UpdateMuteStatesRequest, 'sessionId'>) => Promise<FinishedUnaryCall<UpdateMuteStatesRequest, import("./gen/video/sfu/signal_rpc/signal").UpdateMuteStatesResponse>>;
111
- sendStats: (stats: Omit<SendStatsRequest, 'sessionId'>) => Promise<FinishedUnaryCall<SendStatsRequest, import("./gen/video/sfu/signal_rpc/signal").SendStatsResponse>>;
110
+ updateMuteStates: (data: Omit<UpdateMuteStatesRequest, "sessionId">) => Promise<FinishedUnaryCall<UpdateMuteStatesRequest, import("./gen/video/sfu/signal_rpc/signal").UpdateMuteStatesResponse>>;
111
+ sendStats: (stats: Omit<SendStatsRequest, "sessionId">) => Promise<FinishedUnaryCall<SendStatsRequest, import("./gen/video/sfu/signal_rpc/signal").SendStatsResponse>>;
112
112
  startNoiseCancellation: () => Promise<FinishedUnaryCall<import("./gen/video/sfu/signal_rpc/signal").StartNoiseCancellationRequest, import("./gen/video/sfu/signal_rpc/signal").StartNoiseCancellationResponse>>;
113
113
  stopNoiseCancellation: () => Promise<FinishedUnaryCall<import("./gen/video/sfu/signal_rpc/signal").StopNoiseCancellationRequest, import("./gen/video/sfu/signal_rpc/signal").StopNoiseCancellationResponse>>;
114
- join: (data: Omit<JoinRequest, 'sessionId' | 'token'>) => Promise<void>;
114
+ join: (data: Omit<JoinRequest, "sessionId" | "token">) => Promise<void>;
115
115
  send: (message: SfuRequest) => Promise<void>;
116
116
  private keepAlive;
117
117
  private scheduleConnectionCheck;
@@ -2,7 +2,7 @@ import { Call } from './Call';
2
2
  import { StreamClient } from './coordinator/connection/client';
3
3
  import { StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore } from './store';
4
4
  import type { ConnectedEvent, CreateDeviceRequest, CreateGuestRequest, CreateGuestResponse, GetEdgesResponse, ListDevicesResponse, QueryCallsRequest, QueryCallStatsRequest, QueryCallStatsResponse } from './gen/coordinator';
5
- import { ClientEventListener, Logger, LogLevel, StreamClientOptions, TokenOrProvider, TokenProvider, User, UserWithId } from './coordinator/connection/types';
5
+ import { AllClientEvents, ClientEventListener, Logger, LogLevel, StreamClientOptions, TokenOrProvider, TokenProvider, User, UserWithId } from './coordinator/connection/types';
6
6
  /**
7
7
  * A `StreamVideoClient` instance lets you communicate with our API, and authenticate users.
8
8
  */
@@ -60,14 +60,14 @@ export declare class StreamVideoClient {
60
60
  * @param callback the callback which will be called when the event is emitted.
61
61
  * @returns an unsubscribe function.
62
62
  */
63
- on: <E extends import("./coordinator/connection/types").AllClientEventTypes>(eventName: E, callback: ClientEventListener<E>) => () => void;
63
+ on: <E extends keyof AllClientEvents>(eventName: E, callback: ClientEventListener<E>) => () => void;
64
64
  /**
65
65
  * Remove subscription for WebSocket events that were created by the `on` method.
66
66
  *
67
67
  * @param eventName the event name.
68
68
  * @param callback the callback which was passed to the `on` method.
69
69
  */
70
- off: <E extends import("./coordinator/connection/types").AllClientEventTypes>(eventName: E, callback: ClientEventListener<E>) => void;
70
+ off: <E extends keyof AllClientEvents>(eventName: E, callback: ClientEventListener<E>) => void;
71
71
  /**
72
72
  * Creates a new call.
73
73
  *
@@ -89,8 +89,8 @@ export declare class StreamVideoClient {
89
89
  queryCalls: (data?: QueryCallsRequest) => Promise<{
90
90
  calls: Call[];
91
91
  duration: string;
92
- next?: string | undefined;
93
- prev?: string | undefined;
92
+ next?: string;
93
+ prev?: string;
94
94
  }>;
95
95
  /**
96
96
  * Retrieve the list of available call statistics reports matching a particular condition.
@@ -1,9 +1,8 @@
1
- /// <reference types="node" />
2
1
  import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
3
2
  import { StableWSConnection } from './connection';
4
3
  import { TokenManager } from './token_manager';
5
4
  import { WSConnectionFallback } from './connection_fallback';
6
- import { AllClientEventTypes, APIErrorResponse, ClientEventListener, ConnectAPIResponse, ErrorFromResponse, Logger, StreamClientOptions, StreamVideoEvent, TokenOrProvider, User, UserWithId } from './types';
5
+ import { AllClientEvents, AllClientEventTypes, APIErrorResponse, ClientEventListener, ConnectAPIResponse, ErrorFromResponse, Logger, StreamClientOptions, StreamVideoEvent, TokenOrProvider, User, UserWithId } from './types';
7
6
  import { InsightMetrics } from './insights';
8
7
  import { CreateGuestResponse } from '../../gen/coordinator';
9
8
  export declare class StreamClient {
@@ -97,7 +96,7 @@ export declare class StreamClient {
97
96
  */
98
97
  disconnectUser: (timeout?: number) => Promise<void>;
99
98
  connectGuestUser: (user: User & {
100
- type: 'guest';
99
+ type: "guest";
101
100
  }) => Promise<void | import("../../gen/coordinator").ConnectedEvent>;
102
101
  /**
103
102
  * connectAnonymousUser - Set an anonymous user and open a WebSocket connection
@@ -113,15 +112,15 @@ export declare class StreamClient {
113
112
  *
114
113
  * @return Returns a function which, when called, unsubscribes the event handler.
115
114
  */
116
- on: <E extends AllClientEventTypes>(eventName: E, callback: ClientEventListener<E>) => () => void;
115
+ on: <E extends keyof AllClientEvents>(eventName: E, callback: ClientEventListener<E>) => () => void;
117
116
  /**
118
117
  * off - Remove the event handler
119
118
  */
120
- off: <E extends AllClientEventTypes>(eventName: E, callback: ClientEventListener<E>) => void;
121
- _logApiRequest: (type: string, url: string, data: unknown, config: AxiosRequestConfig<any> & {
122
- config?: (AxiosRequestConfig<any> & {
123
- maxBodyLength?: number | undefined;
124
- }) | undefined;
119
+ off: <E extends keyof AllClientEvents>(eventName: E, callback: ClientEventListener<E>) => void;
120
+ _logApiRequest: (type: string, url: string, data: unknown, config: AxiosRequestConfig & {
121
+ config?: AxiosRequestConfig & {
122
+ maxBodyLength?: number;
123
+ };
125
124
  }) => void;
126
125
  _logApiResponse: <T>(type: string, url: string, response: AxiosResponse<T>) => void;
127
126
  _logApiError: (type: string, url: string, error: unknown) => void;
@@ -132,11 +131,11 @@ export declare class StreamClient {
132
131
  } & {
133
132
  publicEndpoint?: boolean;
134
133
  }) => Promise<T>;
135
- get: <T>(url: string, params?: AxiosRequestConfig['params']) => Promise<T>;
136
- put: <T, D = unknown>(url: string, data?: D, params?: AxiosRequestConfig['params']) => Promise<T>;
137
- post: <T, D = unknown>(url: string, data?: D, params?: AxiosRequestConfig['params']) => Promise<T>;
138
- patch: <T, D = unknown>(url: string, data?: D, params?: AxiosRequestConfig['params']) => Promise<T>;
139
- delete: <T>(url: string, params?: AxiosRequestConfig['params']) => Promise<T>;
134
+ get: <T>(url: string, params?: AxiosRequestConfig["params"]) => Promise<T>;
135
+ put: <T, D = unknown>(url: string, data?: D, params?: AxiosRequestConfig["params"]) => Promise<T>;
136
+ post: <T, D = unknown>(url: string, data?: D, params?: AxiosRequestConfig["params"]) => Promise<T>;
137
+ patch: <T, D = unknown>(url: string, data?: D, params?: AxiosRequestConfig["params"]) => Promise<T>;
138
+ delete: <T>(url: string, params?: AxiosRequestConfig["params"]) => Promise<T>;
140
139
  errorFromResponse: (response: AxiosResponse<APIErrorResponse>) => ErrorFromResponse<APIErrorResponse>;
141
140
  handleResponse: <T>(response: AxiosResponse<T>) => T;
142
141
  dispatchEvent: (event: StreamVideoEvent) => void;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="ws" />
3
1
  import WebSocket from 'isomorphic-ws';
4
2
  import { StreamClient } from './client';
5
3
  import type { ConnectAPIResponse, LogLevel, UR } from './types';
@@ -115,9 +113,9 @@ export declare class StableWSConnection {
115
113
  *
116
114
  */
117
115
  _errorFromWSEvent: (event: WebSocket.CloseEvent | WebSocket.Data | WebSocket.ErrorEvent, isWSFailure?: boolean) => Error & {
118
- code?: string | number | undefined;
119
- isWSFailure?: boolean | undefined;
120
- StatusCode?: string | number | undefined;
116
+ code?: string | number;
117
+ isWSFailure?: boolean;
118
+ StatusCode?: string | number;
121
119
  };
122
120
  /**
123
121
  * _destroyCurrentWSConnection - Removes the current WS connection
@@ -1,4 +1,3 @@
1
- /// <reference types="ws" />
2
1
  import { StableWSConnection } from './connection';
3
2
  export type InsightTypes = 'ws_fatal' | 'ws_success_after_failure' | 'http_hi_failed';
4
3
  export declare class InsightMetrics {
@@ -0,0 +1,24 @@
1
+ interface BrowserPermissionConfig {
2
+ constraints: DisplayMediaStreamOptions;
3
+ queryName: PermissionName;
4
+ }
5
+ export declare class BrowserPermission {
6
+ private readonly permission;
7
+ private ready;
8
+ private disposeController;
9
+ private state;
10
+ private wasPrompted;
11
+ private listeners;
12
+ private logger;
13
+ constructor(permission: BrowserPermissionConfig);
14
+ dispose(): void;
15
+ getState(): Promise<PermissionState>;
16
+ prompt({ forcePrompt, throwOnNotAllowed, }?: {
17
+ forcePrompt?: boolean;
18
+ throwOnNotAllowed?: boolean;
19
+ }): Promise<void>;
20
+ listen(cb: (state: PermissionState) => void): () => boolean;
21
+ asObservable(): import("rxjs").Observable<boolean>;
22
+ private setState;
23
+ }
24
+ export {};
@@ -3,7 +3,7 @@ import { Call } from '../Call';
3
3
  import { InputMediaDeviceManagerState } from './InputMediaDeviceManagerState';
4
4
  import { Logger } from '../coordinator/connection/types';
5
5
  import { TrackType } from '../gen/video/sfu/models/models';
6
- export type MediaStreamFilter = (stream: MediaStream) => Promise<MediaStream>;
6
+ import { MediaStreamFilter, MediaStreamFilterRegistrationResult } from './filters';
7
7
  export declare abstract class InputMediaDeviceManager<T extends InputMediaDeviceManagerState<C>, C = MediaTrackConstraints> {
8
8
  protected readonly call: Call;
9
9
  readonly state: T;
@@ -17,6 +17,7 @@ export declare abstract class InputMediaDeviceManager<T extends InputMediaDevice
17
17
  private isTrackStoppedDueToTrackEnd;
18
18
  private filters;
19
19
  private statusChangeConcurrencyTag;
20
+ private filterRegistrationConcurrencyTag;
20
21
  protected constructor(call: Call, state: T, trackType: TrackType);
21
22
  /**
22
23
  * Lists the available audio/video devices
@@ -55,9 +56,9 @@ export declare abstract class InputMediaDeviceManager<T extends InputMediaDevice
55
56
  * a new stream with the applied filter.
56
57
  *
57
58
  * @param filter the filter to register.
58
- * @returns a function that will unregister the filter.
59
+ * @returns MediaStreamFilterRegistrationResult
59
60
  */
60
- registerFilter(filter: MediaStreamFilter): Promise<() => Promise<void>>;
61
+ registerFilter(filter: MediaStreamFilter): MediaStreamFilterRegistrationResult;
61
62
  /**
62
63
  * Will set the default constraints for the device.
63
64
  *
@@ -1,10 +1,10 @@
1
1
  import { BehaviorSubject, Observable } from 'rxjs';
2
2
  import { RxUtils } from '../store';
3
+ import { BrowserPermission } from './BrowserPermission';
3
4
  export type InputDeviceStatus = 'enabled' | 'disabled' | undefined;
4
5
  export type TrackDisableMode = 'stop-tracks' | 'disable-tracks';
5
6
  export declare abstract class InputMediaDeviceManagerState<C = MediaTrackConstraints> {
6
7
  readonly disableMode: TrackDisableMode;
7
- private readonly permissionName;
8
8
  protected statusSubject: BehaviorSubject<InputDeviceStatus>;
9
9
  protected optimisticStatusSubject: BehaviorSubject<InputDeviceStatus>;
10
10
  protected mediaStreamSubject: BehaviorSubject<MediaStream | undefined>;
@@ -44,10 +44,10 @@ export declare abstract class InputMediaDeviceManagerState<C = MediaTrackConstra
44
44
  * Constructs new InputMediaDeviceManagerState instance.
45
45
  *
46
46
  * @param disableMode the disable mode to use.
47
- * @param permissionName the permission name to use for querying.
47
+ * @param permission the BrowserPermission to use for querying.
48
48
  * `undefined` means no permission is required.
49
49
  */
50
- constructor(disableMode?: TrackDisableMode, permissionName?: PermissionName | undefined);
50
+ constructor(disableMode?: TrackDisableMode, permission?: BrowserPermission);
51
51
  /**
52
52
  * The device status
53
53
  */
@@ -12,6 +12,7 @@ export declare class MicrophoneManager extends InputMediaDeviceManager<Microphon
12
12
  private noiseCancellation;
13
13
  private noiseCancellationChangeUnsubscribe;
14
14
  private noiseCancellationRegistration?;
15
+ private uregisterNoiseCancellation?;
15
16
  constructor(call: Call, disableMode?: TrackDisableMode);
16
17
  /**
17
18
  * Enables noise cancellation for the microphone.
@@ -1,21 +1,40 @@
1
- import { Observable } from 'rxjs';
1
+ import { BrowserPermission } from './BrowserPermission';
2
2
  /**
3
- * [Tells if the browser supports audio output change on 'audio' elements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId).
4
- *
5
- * */
3
+ * Tells if the browser supports audio output change on 'audio' elements,
4
+ * see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId.
5
+ */
6
6
  export declare const checkIfAudioOutputChangeSupported: () => boolean;
7
7
  /**
8
- * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audioinput' devices, if devices are added/removed the list is updated.
8
+ * Keeps track of the browser permission to use microphone. This permission also
9
+ * affects an ability to enumerate audio devices.
10
+ */
11
+ export declare const getAudioBrowserPermission: () => BrowserPermission;
12
+ /**
13
+ * Keeps track of the browser permission to use camera. This permission also
14
+ * affects an ability to enumerate video devices.
15
+ */
16
+ export declare const getVideoBrowserPermission: () => BrowserPermission;
17
+ /**
18
+ * Prompts the user for a permission to use audio devices (if not already granted
19
+ * and was not prompted before) and lists the available 'audioinput' devices,
20
+ * if devices are added/removed the list is updated, and if the permission is revoked,
21
+ * the observable errors.
9
22
  */
10
- export declare const getAudioDevices: () => Observable<MediaDeviceInfo[]>;
23
+ export declare const getAudioDevices: () => import("rxjs").Observable<MediaDeviceInfo[]>;
11
24
  /**
12
- * Prompts the user for a permission to use video devices (if not already granted) and lists the available 'videoinput' devices, if devices are added/removed the list is updated.
25
+ * Prompts the user for a permission to use video devices (if not already granted
26
+ * and was not prompted before) and lists the available 'videoinput' devices,
27
+ * if devices are added/removed the list is updated, and if the permission is revoked,
28
+ * the observable errors.
13
29
  */
14
- export declare const getVideoDevices: () => Observable<MediaDeviceInfo[]>;
30
+ export declare const getVideoDevices: () => import("rxjs").Observable<MediaDeviceInfo[]>;
15
31
  /**
16
- * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audiooutput' devices, if devices are added/removed the list is updated. Selecting 'audiooutput' device only makes sense if [the browser has support for changing audio output on 'audio' elements](#checkifaudiooutputchangesupported)
32
+ * Prompts the user for a permission to use video devices (if not already granted
33
+ * and was not prompted before) and lists the available 'audiooutput' devices,
34
+ * if devices are added/removed the list is updated, and if the permission is revoked,
35
+ * the observable errors.
17
36
  */
18
- export declare const getAudioOutputDevices: () => Observable<MediaDeviceInfo[]>;
37
+ export declare const getAudioOutputDevices: () => import("rxjs").Observable<MediaDeviceInfo[]>;
19
38
  /**
20
39
  * Returns an audio media stream that fulfills the given constraints.
21
40
  * If no constraints are provided, it uses the browser's default ones.
@@ -45,7 +64,7 @@ export declare const getVideoStream: (trackConstraints?: MediaTrackConstraints)
45
64
  * @param options any additional options to pass to the [`getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) API.
46
65
  */
47
66
  export declare const getScreenShareStream: (options?: DisplayMediaStreamOptions) => Promise<MediaStream>;
48
- export declare const deviceIds$: Observable<MediaDeviceInfo[]> | undefined;
67
+ export declare const deviceIds$: import("rxjs").Observable<MediaDeviceInfo[]> | undefined;
49
68
  /**
50
69
  * Deactivates MediaStream (stops and removes tracks) to be later garbage collected
51
70
  *
@@ -0,0 +1,32 @@
1
+ export type MediaStreamFilter = (input: MediaStream) => MediaStreamFilterResult;
2
+ export type MediaStreamFilterCleanup = () => void;
3
+ export interface MediaStreamFilterResult {
4
+ /**
5
+ * Transformed media stream. If the filter is asynchronous, a promise which
6
+ * resolves with a transformed media stream.
7
+ */
8
+ output: MediaStream | Promise<MediaStream>;
9
+ /**
10
+ * An optional cleanup callback. It is called when the filter is stopped, and
11
+ * when it is unregistered.
12
+ */
13
+ stop?: MediaStreamFilterCleanup;
14
+ }
15
+ export interface MediaStreamFilterEntry {
16
+ start: MediaStreamFilter;
17
+ /**
18
+ * When the filter is running, it holds a cleanup callback returned when the filter
19
+ * was started.
20
+ */
21
+ stop: MediaStreamFilterCleanup | undefined;
22
+ }
23
+ export interface MediaStreamFilterRegistrationResult {
24
+ /**
25
+ * Promise that resolves when the filter is applied to the stream.
26
+ */
27
+ registered: Promise<void>;
28
+ /**
29
+ * Function that can be called to unregister the filter.
30
+ */
31
+ unregister: () => Promise<void>;
32
+ }
@@ -22,7 +22,7 @@ export declare class ViewportTracker {
22
22
  * @param options
23
23
  * @returns Unobserve
24
24
  */
25
- setViewport: (viewportElement: HTMLElement, options?: Pick<IntersectionObserverInit, 'threshold' | 'rootMargin'>) => () => void;
25
+ setViewport: (viewportElement: HTMLElement, options?: Pick<IntersectionObserverInit, "threshold" | "rootMargin">) => () => void;
26
26
  /**
27
27
  * Method to set element to observe and handler to be triggered whenever IntersectionObserver
28
28
  * detects a possible change in element's visibility within specified viewport, returns
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Lazily creates a value using a provided factory
3
+ */
4
+ export declare function lazy<T>(factory: () => T): () => T;
@@ -7,7 +7,7 @@
7
7
  * 4. move 96 to the front
8
8
  * 5. now media looks like this: m=video 9 UDP/TLS/RTP/SAVPF 96 100 101 97 35 36 102 125 127
9
9
  */
10
- export declare const setPreferredCodec: (sdp: string, mediaType: 'video' | 'audio', preferredCodec: string) => string;
10
+ export declare const setPreferredCodec: (sdp: string, mediaType: "video" | "audio", preferredCodec: string) => string;
11
11
  /**
12
12
  * Returns an SDP with the specified codec removed.
13
13
  * Example: Suppose we want to remove RED
@@ -18,7 +18,7 @@ export declare const setPreferredCodec: (sdp: string, mediaType: 'video' | 'audi
18
18
  * 5. remove a=rtpmap:127 red/90000
19
19
  * 6. remove a=fmtp:127 ...
20
20
  */
21
- export declare const removeCodec: (sdp: string, mediaType: 'video' | 'audio', codecToRemove: string) => string;
21
+ export declare const removeCodec: (sdp: string, mediaType: "video" | "audio", codecToRemove: string) => string;
22
22
  /**
23
23
  * Returns an SDP with DTX enabled or disabled.
24
24
  */
@@ -20,7 +20,7 @@ export declare class Dispatcher {
20
20
  private readonly logger;
21
21
  private subscribers;
22
22
  dispatch: <K extends SfuEventKinds>(message: DispatchableMessage<K>) => void;
23
- on: <E extends SfuEventKinds>(eventName: E, fn: CallEventListener<E>) => () => void;
24
- off: <E extends SfuEventKinds>(eventName: E, fn: CallEventListener<E>) => void;
23
+ on: <E extends keyof AllSfuEvents>(eventName: E, fn: CallEventListener<E>) => () => void;
24
+ off: <E extends keyof AllSfuEvents>(eventName: E, fn: CallEventListener<E>) => void;
25
25
  offAll: (eventName?: SfuEventKinds) => void;
26
26
  }
@@ -1,2 +1,2 @@
1
- export declare const getPreferredCodecs: (kind: 'audio' | 'video', preferredCodec: string, codecToRemove?: string) => RTCRtpCodecCapability[] | undefined;
1
+ export declare const getPreferredCodecs: (kind: "audio" | "video", preferredCodec: string, codecToRemove?: string) => RTCRtpCodecCapability[] | undefined;
2
2
  export declare const getGenericSdp: (direction: RTCRtpTransceiverDirection) => Promise<string>;
@@ -1,4 +1,3 @@
1
- /// <reference types="ws" />
2
1
  import WebSocket from 'isomorphic-ws';
3
2
  import { DispatchableMessage, SfuEventKinds } from './Dispatcher';
4
3
  export declare const createWebSocketSignalChannel: (opts: {
@@ -7,12 +7,12 @@ import { Sdk } from '../gen/video/sfu/models/models';
7
7
  */
8
8
  export declare const flatten: (report: RTCStatsReport) => RTCStats[];
9
9
  export declare const getSdkSignature: (clientDetails: LocalClientDetailsType) => {
10
- os?: import("../gen/video/sfu/models/models").OS | undefined;
11
- browser?: import("../gen/video/sfu/models/models").Browser | undefined;
12
- device?: import("../gen/video/sfu/models/models").Device | undefined;
10
+ os?: import("../gen/video/sfu/models/models").OS;
11
+ browser?: import("../gen/video/sfu/models/models").Browser;
12
+ device?: import("../gen/video/sfu/models/models").Device;
13
13
  webRTCInfo?: {
14
14
  version: string;
15
- } | undefined;
15
+ };
16
16
  sdkName: string;
17
17
  sdkVersion: string;
18
18
  };
@@ -448,7 +448,7 @@ export declare class CallState {
448
448
  * @param patch the patch to apply to the participant.
449
449
  * @returns the updated participant or `undefined` if the participant couldn't be found.
450
450
  */
451
- updateParticipant: (sessionId: string, patch: Partial<StreamVideoParticipant> | ((p: StreamVideoParticipant) => StreamVideoParticipantPatch)) => StreamVideoParticipant[] | undefined;
451
+ updateParticipant: (sessionId: string, patch: StreamVideoParticipantPatch | ((p: StreamVideoParticipant) => StreamVideoParticipantPatch)) => StreamVideoParticipant[] | undefined;
452
452
  /**
453
453
  * Updates a participant in the current call identified by the given `sessionId`.
454
454
  * If a participant with matching `sessionId` can't be found, the provided
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -52,10 +52,10 @@
52
52
  "@vitest/coverage-v8": "^0.34.4",
53
53
  "dotenv": "^16.3.1",
54
54
  "happy-dom": "^11.0.2",
55
- "prettier": "^3.3.0",
56
- "rimraf": "^5.0.5",
55
+ "prettier": "^3.3.2",
56
+ "rimraf": "^5.0.7",
57
57
  "rollup": "^3.29.4",
58
- "typescript": "^5.4.3",
58
+ "typescript": "^5.5.2",
59
59
  "vite": "^4.4.11",
60
60
  "vitest": "^0.34.4",
61
61
  "vitest-mock-extended": "^1.2.1"