@stream-io/video-client 0.0.28 → 0.0.29

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 (67) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/index.browser.es.js +2514 -1757
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +2534 -1755
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +2514 -1757
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/Call.d.ts +2 -3
  9. package/dist/src/StreamSfuClient.d.ts +23 -10
  10. package/dist/src/StreamVideoClient.d.ts +1 -4
  11. package/dist/src/client-details.d.ts +2 -1
  12. package/dist/src/coordinator/connection/types.d.ts +2 -2
  13. package/dist/src/coordinator/connection/utils.d.ts +1 -0
  14. package/dist/src/events/internal.d.ts +4 -0
  15. package/dist/src/gen/coordinator/index.d.ts +6 -0
  16. package/dist/src/gen/google/protobuf/struct.d.ts +8 -15
  17. package/dist/src/gen/google/protobuf/timestamp.d.ts +2 -9
  18. package/dist/src/gen/video/sfu/event/events.d.ts +121 -1
  19. package/dist/src/gen/video/sfu/models/models.d.ts +38 -1
  20. package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +3 -14
  21. package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +4 -12
  22. package/dist/src/logger.d.ts +4 -2
  23. package/dist/src/rtc/Dispatcher.d.ts +1 -2
  24. package/dist/src/rtc/{publisher.d.ts → Publisher.d.ts} +49 -15
  25. package/dist/src/rtc/Subscriber.d.ts +58 -0
  26. package/dist/src/rtc/__tests__/Subscriber.test.d.ts +1 -0
  27. package/dist/src/rtc/flows/join.d.ts +8 -1
  28. package/dist/src/rtc/index.d.ts +2 -2
  29. package/dist/src/rtc/signal.d.ts +1 -0
  30. package/dist/src/stats/state-store-stats-reporter.d.ts +3 -4
  31. package/dist/src/store/CallState.d.ts +10 -0
  32. package/package.json +3 -1
  33. package/src/Call.ts +215 -209
  34. package/src/StreamSfuClient.ts +48 -21
  35. package/src/StreamVideoClient.ts +7 -24
  36. package/src/client-details.ts +33 -1
  37. package/src/coordinator/connection/client.ts +6 -8
  38. package/src/coordinator/connection/types.ts +2 -3
  39. package/src/coordinator/connection/utils.ts +1 -0
  40. package/src/events/call.ts +0 -1
  41. package/src/events/callEventHandlers.ts +2 -0
  42. package/src/events/internal.ts +20 -0
  43. package/src/events/sessions.ts +0 -1
  44. package/src/gen/coordinator/index.ts +6 -0
  45. package/src/gen/google/protobuf/struct.ts +541 -333
  46. package/src/gen/google/protobuf/timestamp.ts +214 -148
  47. package/src/gen/video/sfu/event/events.ts +353 -3
  48. package/src/gen/video/sfu/models/models.ts +37 -0
  49. package/src/gen/video/sfu/signal_rpc/signal.client.ts +160 -94
  50. package/src/gen/video/sfu/signal_rpc/signal.ts +1214 -731
  51. package/src/logger.ts +43 -30
  52. package/src/rtc/Dispatcher.ts +5 -9
  53. package/src/rtc/{publisher.ts → Publisher.ts} +245 -111
  54. package/src/rtc/Subscriber.ts +304 -0
  55. package/src/rtc/__tests__/{publisher.test.ts → Publisher.test.ts} +77 -9
  56. package/src/rtc/__tests__/Subscriber.test.ts +121 -0
  57. package/src/rtc/__tests__/mocks/webrtc.mocks.ts +20 -0
  58. package/src/rtc/flows/join.ts +43 -2
  59. package/src/rtc/index.ts +2 -2
  60. package/src/rtc/signal.ts +6 -5
  61. package/src/rtc/videoLayers.ts +1 -4
  62. package/src/stats/state-store-stats-reporter.ts +3 -5
  63. package/src/store/CallState.ts +20 -0
  64. package/src/types.ts +0 -1
  65. package/dist/src/rtc/subscriber.d.ts +0 -9
  66. package/src/rtc/subscriber.ts +0 -107
  67. /package/dist/src/rtc/__tests__/{publisher.test.d.ts → Publisher.test.d.ts} +0 -0
@@ -119,7 +119,6 @@ export declare class Call {
119
119
  * A flag indicating whether the call was created by the current user.
120
120
  */
121
121
  get isCreatedByMe(): boolean;
122
- private waitForJoinResponse;
123
122
  /**
124
123
  * Loads the information about the call.
125
124
  *
@@ -170,6 +169,8 @@ export declare class Call {
170
169
  * @returns a promise which resolves once the call join-flow has finished.
171
170
  */
172
171
  join: (data?: JoinCallData) => Promise<void>;
172
+ private waitForJoinResponse;
173
+ private assertCallJoined;
173
174
  /**
174
175
  * Starts publishing the given video stream to the call.
175
176
  * The stream will be stopped if the user changes an input device, or if the user leaves the call.
@@ -281,8 +282,6 @@ export declare class Call {
281
282
  * @returns
282
283
  */
283
284
  updatePublishQuality: (enabledRids: string[]) => Promise<void | undefined>;
284
- private handleOnTrack;
285
- private assertCallJoined;
286
285
  /**
287
286
  * Sends a reaction to the other call participants.
288
287
  *
@@ -1,21 +1,19 @@
1
+ import type { WebSocket } from 'ws';
1
2
  import type { FinishedUnaryCall } from '@protobuf-ts/runtime-rpc';
2
3
  import { Dispatcher, IceTrickleBuffer } from './rtc';
3
4
  import { JoinRequest, SfuRequest } from './gen/video/sfu/event/events';
4
5
  import { SendAnswerRequest, SetPublisherRequest, TrackSubscriptionDetails, UpdateMuteStatesRequest } from './gen/video/sfu/signal_rpc/signal';
5
6
  import { ICETrickle, TrackType } from './gen/video/sfu/models/models';
7
+ import { SFUResponse } from './gen/coordinator';
6
8
  export type StreamSfuClientConstructor = {
7
9
  /**
8
10
  * The event dispatcher instance to use.
9
11
  */
10
12
  dispatcher: Dispatcher;
11
13
  /**
12
- * The URL of the SFU to connect to.
14
+ * The SFU server to connect to.
13
15
  */
14
- url: string;
15
- /**
16
- * The WebSocket endpoint of the SFU to connect to.
17
- */
18
- wsEndpoint: string;
16
+ sfuServer: SFUResponse;
19
17
  /**
20
18
  * The JWT token to use for authentication.
21
19
  */
@@ -39,6 +37,18 @@ export declare class StreamSfuClient {
39
37
  * The `sessionId` of the currently connected participant.
40
38
  */
41
39
  readonly sessionId: string;
40
+ /**
41
+ * The `edgeName` representing the edge the client is connected to.
42
+ */
43
+ readonly edgeName: string;
44
+ /**
45
+ * The current token used for authenticating against the SFU.
46
+ */
47
+ readonly token: string;
48
+ /**
49
+ * The SFU server details the current client is connected to.
50
+ */
51
+ readonly sfuServer: SFUResponse;
42
52
  /**
43
53
  * Holds the current WebSocket connection to the SFU.
44
54
  */
@@ -47,8 +57,12 @@ export declare class StreamSfuClient {
47
57
  * Promise that resolves when the WebSocket connection is ready (open).
48
58
  */
49
59
  signalReady: Promise<WebSocket>;
60
+ /**
61
+ * A flag indicating whether the client is currently migrating away
62
+ * from this SFU.
63
+ */
64
+ isMigratingAway: boolean;
50
65
  private readonly rpc;
51
- private readonly token;
52
66
  private keepAliveInterval?;
53
67
  private connectionCheckTimeout?;
54
68
  private pingIntervalInMs;
@@ -60,12 +74,11 @@ export declare class StreamSfuClient {
60
74
  * Constructs a new SFU client.
61
75
  *
62
76
  * @param dispatcher the event dispatcher to use.
63
- * @param url the URL of the SFU.
64
- * @param wsEndpoint the WebSocket endpoint of the SFU.
77
+ * @param sfuServer the SFU server to connect to.
65
78
  * @param token the JWT token to use for authentication.
66
79
  * @param sessionId the `sessionId` of the currently connected participant.
67
80
  */
68
- constructor({ dispatcher, url, wsEndpoint, token, sessionId, }: StreamSfuClientConstructor);
81
+ constructor({ dispatcher, sfuServer, token, sessionId, }: StreamSfuClientConstructor);
69
82
  close: (code?: number, reason?: string) => void;
70
83
  updateSubscriptions: (subscriptions: TrackSubscriptionDetails[]) => Promise<FinishedUnaryCall<import("./gen/video/sfu/signal_rpc/signal").UpdateSubscriptionsRequest, import("./gen/video/sfu/signal_rpc/signal").UpdateSubscriptionsResponse>>;
71
84
  setPublisher: (data: Omit<SetPublisherRequest, 'sessionId'>) => Promise<FinishedUnaryCall<SetPublisherRequest, import("./gen/video/sfu/signal_rpc/signal").SetPublisherResponse>>;
@@ -2,7 +2,7 @@ import { Call } from './Call';
2
2
  import { StreamClient } from './coordinator/connection/client';
3
3
  import { StreamVideoReadOnlyStateStore } from './store';
4
4
  import type { ConnectedEvent, CreateCallTypeRequest, CreateCallTypeResponse, CreateDeviceRequest, CreateGuestRequest, CreateGuestResponse, GetCallTypeResponse, GetEdgesResponse, ListCallTypeResponse, ListDevicesResponse, QueryCallsRequest, UpdateCallTypeRequest, UpdateCallTypeResponse } from './gen/coordinator';
5
- import type { EventHandler, EventTypes, LogLevel, Logger, StreamClientOptions, TokenOrProvider, TokenProvider, User } from './coordinator/connection/types';
5
+ import type { EventHandler, EventTypes, Logger, StreamClientOptions, TokenOrProvider, TokenProvider, User } from './coordinator/connection/types';
6
6
  /**
7
7
  * A `StreamVideoClient` instance lets you communicate with our API, and authenticate users.
8
8
  */
@@ -13,14 +13,12 @@ export declare class StreamVideoClient {
13
13
  readonly readOnlyStateStore: StreamVideoReadOnlyStateStore;
14
14
  readonly user?: User;
15
15
  readonly token?: TokenOrProvider;
16
- readonly logLevel: LogLevel;
17
16
  readonly logger: Logger;
18
17
  private readonly writeableStateStore;
19
18
  streamClient: StreamClient;
20
19
  private eventHandlersToUnregister;
21
20
  private connectionPromise;
22
21
  private disconnectionPromise;
23
- private logLevels;
24
22
  /**
25
23
  * You should create only one instance of `StreamVideoClient`.
26
24
  */
@@ -150,5 +148,4 @@ export declare class StreamVideoClient {
150
148
  * @param tokenOrProvider a token or a function that returns a token.
151
149
  */
152
150
  private connectAnonymousUser;
153
- private filterLogs;
154
151
  }
@@ -1,7 +1,8 @@
1
- import { Device, OS, Sdk } from './gen/video/sfu/models/models';
1
+ import { ClientDetails, Device, OS, Sdk } from './gen/video/sfu/models/models';
2
2
  export declare const setSdkInfo: (info: Sdk) => void;
3
3
  export declare const getSdkInfo: () => Sdk | undefined;
4
4
  export declare const setOSInfo: (info: OS) => void;
5
5
  export declare const getOSInfo: () => OS | undefined;
6
6
  export declare const setDeviceInfo: (info: Device) => void;
7
7
  export declare const getDeviceInfo: () => Device | undefined;
8
+ export declare const getClientDetails: () => ClientDetails;
@@ -20,7 +20,7 @@ export type UserWithId = (UserRequest & {
20
20
  });
21
21
  export type { OwnUserResponse } from '../../gen/coordinator';
22
22
  export type ConnectAPIResponse = Promise<void | ConnectedEvent>;
23
- export type LogLevel = 'debug' | 'info' | 'error' | 'warn';
23
+ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
24
24
  type ErrorResponseDetails = {
25
25
  code: number;
26
26
  messages: string[];
@@ -59,7 +59,7 @@ export type EventHandler = (event: StreamVideoEvent) => void;
59
59
  export type CallEventHandler = (event: StreamCallEvent) => void;
60
60
  export type EventTypes = 'all' | StreamVideoEvent['type'];
61
61
  export type CallEventTypes = StreamCallEvent['type'];
62
- export type Logger = (logLevel: LogLevel, message: string, extraData?: any, tags?: string[]) => void;
62
+ export type Logger = (logLevel: LogLevel, message: string, ...args: unknown[]) => void;
63
63
  export type StreamClientOptions = Partial<AxiosRequestConfig> & {
64
64
  /**
65
65
  * Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
@@ -7,6 +7,7 @@ export declare function isFunction<T>(value: Function | T): value is Function;
7
7
  export declare const KnownCodes: {
8
8
  TOKEN_EXPIRED: number;
9
9
  WS_CLOSED_SUCCESS: number;
10
+ WS_CLOSED_ABRUPTLY: number;
10
11
  WS_POLICY_VIOLATION: number;
11
12
  };
12
13
  /**
@@ -11,3 +11,7 @@ export declare const watchConnectionQualityChanged: (dispatcher: Dispatcher, sta
11
11
  * health check events that our SFU sends.
12
12
  */
13
13
  export declare const watchParticipantCountChanged: (dispatcher: Dispatcher, state: CallState) => () => void;
14
+ /**
15
+ * Watches and logs the errors reported by the currently connected SFU.
16
+ */
17
+ export declare const watchSfuErrorReports: (dispatcher: Dispatcher) => () => void;
@@ -2477,6 +2477,12 @@ export interface JoinCallRequest {
2477
2477
  * @memberof JoinCallRequest
2478
2478
  */
2479
2479
  members_limit?: number;
2480
+ /**
2481
+ * If the participant is migrating from another SFU, then this is the ID of the previous SFU
2482
+ * @type {string}
2483
+ * @memberof JoinCallRequest
2484
+ */
2485
+ migrating_from?: string;
2480
2486
  /**
2481
2487
  *
2482
2488
  * @type {boolean}
@@ -1,12 +1,5 @@
1
- import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
- import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
- import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
- import type { IBinaryReader } from "@protobuf-ts/runtime";
5
- import type { PartialMessage } from "@protobuf-ts/runtime";
6
- import type { JsonValue } from "@protobuf-ts/runtime";
7
- import type { JsonReadOptions } from "@protobuf-ts/runtime";
8
- import type { JsonWriteOptions } from "@protobuf-ts/runtime";
9
- import { MessageType } from "@protobuf-ts/runtime";
1
+ import type { BinaryReadOptions, BinaryWriteOptions, IBinaryReader, IBinaryWriter, JsonReadOptions, JsonValue, JsonWriteOptions, PartialMessage } from '@protobuf-ts/runtime';
2
+ import { MessageType } from '@protobuf-ts/runtime';
10
3
  /**
11
4
  * `Struct` represents a structured data value, consisting of fields
12
5
  * which map to dynamically typed values. In some languages, `Struct`
@@ -44,7 +37,7 @@ export interface Value {
44
37
  * @generated from protobuf oneof: kind
45
38
  */
46
39
  kind: {
47
- oneofKind: "nullValue";
40
+ oneofKind: 'nullValue';
48
41
  /**
49
42
  * Represents a null value.
50
43
  *
@@ -52,7 +45,7 @@ export interface Value {
52
45
  */
53
46
  nullValue: NullValue;
54
47
  } | {
55
- oneofKind: "numberValue";
48
+ oneofKind: 'numberValue';
56
49
  /**
57
50
  * Represents a double value.
58
51
  *
@@ -60,7 +53,7 @@ export interface Value {
60
53
  */
61
54
  numberValue: number;
62
55
  } | {
63
- oneofKind: "stringValue";
56
+ oneofKind: 'stringValue';
64
57
  /**
65
58
  * Represents a string value.
66
59
  *
@@ -68,7 +61,7 @@ export interface Value {
68
61
  */
69
62
  stringValue: string;
70
63
  } | {
71
- oneofKind: "boolValue";
64
+ oneofKind: 'boolValue';
72
65
  /**
73
66
  * Represents a boolean value.
74
67
  *
@@ -76,7 +69,7 @@ export interface Value {
76
69
  */
77
70
  boolValue: boolean;
78
71
  } | {
79
- oneofKind: "structValue";
72
+ oneofKind: 'structValue';
80
73
  /**
81
74
  * Represents a structured value.
82
75
  *
@@ -84,7 +77,7 @@ export interface Value {
84
77
  */
85
78
  structValue: Struct;
86
79
  } | {
87
- oneofKind: "listValue";
80
+ oneofKind: 'listValue';
88
81
  /**
89
82
  * Represents a repeated `Value`.
90
83
  *
@@ -1,12 +1,5 @@
1
- import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
- import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
- import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
- import type { IBinaryReader } from "@protobuf-ts/runtime";
5
- import type { PartialMessage } from "@protobuf-ts/runtime";
6
- import type { JsonValue } from "@protobuf-ts/runtime";
7
- import type { JsonReadOptions } from "@protobuf-ts/runtime";
8
- import type { JsonWriteOptions } from "@protobuf-ts/runtime";
9
- import { MessageType } from "@protobuf-ts/runtime";
1
+ import type { BinaryReadOptions, BinaryWriteOptions, IBinaryReader, IBinaryWriter, JsonReadOptions, JsonValue, JsonWriteOptions, PartialMessage } from '@protobuf-ts/runtime';
2
+ import { MessageType } from '@protobuf-ts/runtime';
10
3
  /**
11
4
  * A Timestamp represents a point in time independent of any time zone or local
12
5
  * calendar, encoded as a count of seconds and fractions of seconds at
@@ -1,6 +1,7 @@
1
1
  import type { BinaryReadOptions, BinaryWriteOptions, IBinaryReader, IBinaryWriter, PartialMessage } from '@protobuf-ts/runtime';
2
2
  import { MessageType } from '@protobuf-ts/runtime';
3
- import { CallGrants, CallState, ClientDetails, Codec, ConnectionQuality, Error as Error$, ICETrickle as ICETrickle$, Participant, ParticipantCount, PeerType, TrackType, TrackUnpublishReason } from '../models/models';
3
+ import { CallGrants, CallState, ClientDetails, Codec, ConnectionQuality, Error as Error$, GoAwayReason, ICETrickle as ICETrickle$, Participant, ParticipantCount, PeerType, TrackInfo, TrackType, TrackUnpublishReason } from '../models/models';
4
+ import { TrackSubscriptionDetails } from '../signal_rpc/signal';
4
5
  /**
5
6
  * SFUEvent is a message that is sent from the SFU to the client.
6
7
  *
@@ -13,93 +14,152 @@ export interface SfuEvent {
13
14
  eventPayload: {
14
15
  oneofKind: 'subscriberOffer';
15
16
  /**
17
+ * SubscriberOffer sends the SDP offer for establishing the
18
+ * subscriber PeerConnection.
19
+ *
16
20
  * @generated from protobuf field: stream.video.sfu.event.SubscriberOffer subscriber_offer = 1;
17
21
  */
18
22
  subscriberOffer: SubscriberOffer;
19
23
  } | {
20
24
  oneofKind: 'publisherAnswer';
21
25
  /**
26
+ * PublisherAnswer sends the SDP answer to the offer sent by
27
+ * the client for establishing the Publisher PeerConnection.
28
+ *
22
29
  * @generated from protobuf field: stream.video.sfu.event.PublisherAnswer publisher_answer = 2;
23
30
  */
24
31
  publisherAnswer: PublisherAnswer;
25
32
  } | {
26
33
  oneofKind: 'connectionQualityChanged';
27
34
  /**
35
+ * ConnectionQualityChanged is sent to inform the connection
36
+ * quality of the participants in the call. It does not have
37
+ * to contain the full list of call participants in it.
38
+ *
28
39
  * @generated from protobuf field: stream.video.sfu.event.ConnectionQualityChanged connection_quality_changed = 3;
29
40
  */
30
41
  connectionQualityChanged: ConnectionQualityChanged;
31
42
  } | {
32
43
  oneofKind: 'audioLevelChanged';
33
44
  /**
45
+ * AudioLevelChanged is sent for change in audio levels of
46
+ * the participants.
47
+ *
34
48
  * @generated from protobuf field: stream.video.sfu.event.AudioLevelChanged audio_level_changed = 4;
35
49
  */
36
50
  audioLevelChanged: AudioLevelChanged;
37
51
  } | {
38
52
  oneofKind: 'iceTrickle';
39
53
  /**
54
+ * ICETrickle contains the ICE candidate required to establish
55
+ * the ICE transport: part of establishing the PeerConnection
56
+ * and also for ICE restarts.
57
+ *
40
58
  * @generated from protobuf field: stream.video.sfu.models.ICETrickle ice_trickle = 5;
41
59
  */
42
60
  iceTrickle: ICETrickle$;
43
61
  } | {
44
62
  oneofKind: 'changePublishQuality';
45
63
  /**
64
+ * ChangePublishQuality advises the publisher to switch on/off
65
+ * various qualities of their video stream based on the subscription.
66
+ * This is done to save the bandwidth and the CPU of the publisher.
67
+ *
46
68
  * @generated from protobuf field: stream.video.sfu.event.ChangePublishQuality change_publish_quality = 6;
47
69
  */
48
70
  changePublishQuality: ChangePublishQuality;
49
71
  } | {
50
72
  oneofKind: 'participantJoined';
51
73
  /**
74
+ * ParticipantJoined notifies the client that a new participant
75
+ * has joined the call. This is not sent for anonymous users.
76
+ *
52
77
  * @generated from protobuf field: stream.video.sfu.event.ParticipantJoined participant_joined = 10;
53
78
  */
54
79
  participantJoined: ParticipantJoined;
55
80
  } | {
56
81
  oneofKind: 'participantLeft';
57
82
  /**
83
+ * ParticipantLeft notifies the client that a call participant
84
+ * has left the call. This is not sent for anonymous users.
85
+ *
58
86
  * @generated from protobuf field: stream.video.sfu.event.ParticipantLeft participant_left = 11;
59
87
  */
60
88
  participantLeft: ParticipantLeft;
61
89
  } | {
62
90
  oneofKind: 'dominantSpeakerChanged';
63
91
  /**
92
+ * DominantSpeakerChanged notifies the client about the current
93
+ * dominant speaker. This is required for certain use cases like
94
+ * the spotlight view.
95
+ *
64
96
  * @generated from protobuf field: stream.video.sfu.event.DominantSpeakerChanged dominant_speaker_changed = 12;
65
97
  */
66
98
  dominantSpeakerChanged: DominantSpeakerChanged;
67
99
  } | {
68
100
  oneofKind: 'joinResponse';
69
101
  /**
102
+ * JoinResponse acknowledges a participant successfully joining
103
+ * the call. This is sent in response to the JoinRequest.
104
+ *
70
105
  * @generated from protobuf field: stream.video.sfu.event.JoinResponse join_response = 13;
71
106
  */
72
107
  joinResponse: JoinResponse;
73
108
  } | {
74
109
  oneofKind: 'healthCheckResponse';
75
110
  /**
111
+ * HealthCheckResponse is sent in response to the HealthCheckRequest.
112
+ * It contains the participant count in the call.
113
+ *
76
114
  * @generated from protobuf field: stream.video.sfu.event.HealthCheckResponse health_check_response = 14;
77
115
  */
78
116
  healthCheckResponse: HealthCheckResponse;
79
117
  } | {
80
118
  oneofKind: 'trackPublished';
81
119
  /**
120
+ * TrackPublished is sent when a new track (like audio, video, screenshare)
121
+ * is published by a participant in the call. It is also sent on mute/unmute.
122
+ *
82
123
  * @generated from protobuf field: stream.video.sfu.event.TrackPublished track_published = 16;
83
124
  */
84
125
  trackPublished: TrackPublished;
85
126
  } | {
86
127
  oneofKind: 'trackUnpublished';
87
128
  /**
129
+ * TrackUnpublished is sent when a track (like audio, video, screenshare)
130
+ * is no longer published. It is sent on muting a track or when the participant
131
+ * is leaving the call.
132
+ *
88
133
  * @generated from protobuf field: stream.video.sfu.event.TrackUnpublished track_unpublished = 17;
89
134
  */
90
135
  trackUnpublished: TrackUnpublished;
91
136
  } | {
92
137
  oneofKind: 'error';
93
138
  /**
139
+ * Error is used to communicate any error related to the participant. The
140
+ * error code and the message explain what went wrong. Whether the participant
141
+ * can retry is also indicated.
142
+ *
94
143
  * @generated from protobuf field: stream.video.sfu.event.Error error = 18;
95
144
  */
96
145
  error: Error;
97
146
  } | {
98
147
  oneofKind: 'callGrantsUpdated';
99
148
  /**
149
+ * CallGrantsUpdated tells what tracks a participant is allowed to publish.
150
+ *
100
151
  * @generated from protobuf field: stream.video.sfu.event.CallGrantsUpdated call_grants_updated = 19;
101
152
  */
102
153
  callGrantsUpdated: CallGrantsUpdated;
154
+ } | {
155
+ oneofKind: 'goAway';
156
+ /**
157
+ * GoAway tells the client to migrate away from the SFU it is connected to.
158
+ * The reason field indicates why this message was sent.
159
+ *
160
+ * @generated from protobuf field: stream.video.sfu.event.GoAway go_away = 20;
161
+ */
162
+ goAway: GoAway;
103
163
  } | {
104
164
  oneofKind: undefined;
105
165
  };
@@ -245,6 +305,30 @@ export interface JoinRequest {
245
305
  * @generated from protobuf field: stream.video.sfu.models.ClientDetails client_details = 4;
246
306
  */
247
307
  clientDetails?: ClientDetails;
308
+ /**
309
+ * TODO: we should know if this is going to be
310
+ * - publishing and subscribing, or just subscribing for future routing
311
+ *
312
+ * @generated from protobuf field: stream.video.sfu.event.Migration migration = 5;
313
+ */
314
+ migration?: Migration;
315
+ }
316
+ /**
317
+ * @generated from protobuf message stream.video.sfu.event.Migration
318
+ */
319
+ export interface Migration {
320
+ /**
321
+ * @generated from protobuf field: string from_sfu_id = 1;
322
+ */
323
+ fromSfuId: string;
324
+ /**
325
+ * @generated from protobuf field: repeated stream.video.sfu.models.TrackInfo announced_tracks = 2;
326
+ */
327
+ announcedTracks: TrackInfo[];
328
+ /**
329
+ * @generated from protobuf field: repeated stream.video.sfu.signal.TrackSubscriptionDetails subscriptions = 3;
330
+ */
331
+ subscriptions: TrackSubscriptionDetails[];
248
332
  }
249
333
  /**
250
334
  * @generated from protobuf message stream.video.sfu.event.JoinResponse
@@ -256,6 +340,10 @@ export interface JoinResponse {
256
340
  * @generated from protobuf field: stream.video.sfu.models.CallState call_state = 1;
257
341
  */
258
342
  callState?: CallState;
343
+ /**
344
+ * @generated from protobuf field: bool ice_restart = 2;
345
+ */
346
+ iceRestart: boolean;
259
347
  }
260
348
  /**
261
349
  * ParticipantJoined is fired when a user joins a call
@@ -540,6 +628,18 @@ export interface CallGrantsUpdated {
540
628
  */
541
629
  message: string;
542
630
  }
631
+ /**
632
+ * Go away is sent by the SFU to the client to signal to migrate away from the SFU.
633
+ * The evict reason may specify why the user is being evicted.
634
+ *
635
+ * @generated from protobuf message stream.video.sfu.event.GoAway
636
+ */
637
+ export interface GoAway {
638
+ /**
639
+ * @generated from protobuf field: stream.video.sfu.models.GoAwayReason reason = 1;
640
+ */
641
+ reason: GoAwayReason;
642
+ }
543
643
  declare class SfuEvent$Type extends MessageType<SfuEvent> {
544
644
  constructor();
545
645
  create(value?: PartialMessage<SfuEvent>): SfuEvent;
@@ -630,6 +730,16 @@ declare class JoinRequest$Type extends MessageType<JoinRequest> {
630
730
  * @generated MessageType for protobuf message stream.video.sfu.event.JoinRequest
631
731
  */
632
732
  export declare const JoinRequest: JoinRequest$Type;
733
+ declare class Migration$Type extends MessageType<Migration> {
734
+ constructor();
735
+ create(value?: PartialMessage<Migration>): Migration;
736
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Migration): Migration;
737
+ internalBinaryWrite(message: Migration, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
738
+ }
739
+ /**
740
+ * @generated MessageType for protobuf message stream.video.sfu.event.Migration
741
+ */
742
+ export declare const Migration: Migration$Type;
633
743
  declare class JoinResponse$Type extends MessageType<JoinResponse> {
634
744
  constructor();
635
745
  create(value?: PartialMessage<JoinResponse>): JoinResponse;
@@ -800,4 +910,14 @@ declare class CallGrantsUpdated$Type extends MessageType<CallGrantsUpdated> {
800
910
  * @generated MessageType for protobuf message stream.video.sfu.event.CallGrantsUpdated
801
911
  */
802
912
  export declare const CallGrantsUpdated: CallGrantsUpdated$Type;
913
+ declare class GoAway$Type extends MessageType<GoAway> {
914
+ constructor();
915
+ create(value?: PartialMessage<GoAway>): GoAway;
916
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GoAway): GoAway;
917
+ internalBinaryWrite(message: GoAway, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
918
+ }
919
+ /**
920
+ * @generated MessageType for protobuf message stream.video.sfu.event.GoAway
921
+ */
922
+ export declare const GoAway: GoAway$Type;
803
923
  export {};
@@ -522,6 +522,22 @@ export declare enum ErrorCode {
522
522
  * @generated from protobuf enum value: ERROR_CODE_PARTICIPANT_NOT_FOUND = 200;
523
523
  */
524
524
  PARTICIPANT_NOT_FOUND = 200,
525
+ /**
526
+ * @generated from protobuf enum value: ERROR_CODE_PARTICIPANT_MIGRATING_OUT = 201;
527
+ */
528
+ PARTICIPANT_MIGRATING_OUT = 201,
529
+ /**
530
+ * @generated from protobuf enum value: ERROR_CODE_PARTICIPANT_MIGRATION_FAILED = 202;
531
+ */
532
+ PARTICIPANT_MIGRATION_FAILED = 202,
533
+ /**
534
+ * @generated from protobuf enum value: ERROR_CODE_PARTICIPANT_MIGRATING = 203;
535
+ */
536
+ PARTICIPANT_MIGRATING = 203,
537
+ /**
538
+ * @generated from protobuf enum value: ERROR_CODE_PARTICIPANT_RECONNECT_FAILED = 204;
539
+ */
540
+ PARTICIPANT_RECONNECT_FAILED = 204,
525
541
  /**
526
542
  * @generated from protobuf enum value: ERROR_CODE_CALL_NOT_FOUND = 300;
527
543
  */
@@ -545,7 +561,11 @@ export declare enum ErrorCode {
545
561
  /**
546
562
  * @generated from protobuf enum value: ERROR_CODE_INTERNAL_SERVER_ERROR = 500;
547
563
  */
548
- INTERNAL_SERVER_ERROR = 500
564
+ INTERNAL_SERVER_ERROR = 500,
565
+ /**
566
+ * @generated from protobuf enum value: ERROR_CODE_SFU_SHUTTING_DOWN = 600;
567
+ */
568
+ SFU_SHUTTING_DOWN = 600
549
569
  }
550
570
  /**
551
571
  * @generated from protobuf enum stream.video.sfu.models.SdkType
@@ -615,6 +635,23 @@ export declare enum TrackUnpublishReason {
615
635
  */
616
636
  MODERATION = 3
617
637
  }
638
+ /**
639
+ * @generated from protobuf enum stream.video.sfu.models.GoAwayReason
640
+ */
641
+ export declare enum GoAwayReason {
642
+ /**
643
+ * @generated from protobuf enum value: GO_AWAY_REASON_UNSPECIFIED = 0;
644
+ */
645
+ UNSPECIFIED = 0,
646
+ /**
647
+ * @generated from protobuf enum value: GO_AWAY_REASON_SHUTTING_DOWN = 1;
648
+ */
649
+ SHUTTING_DOWN = 1,
650
+ /**
651
+ * @generated from protobuf enum value: GO_AWAY_REASON_REBALANCE = 2;
652
+ */
653
+ REBALANCE = 2
654
+ }
618
655
  declare class CallState$Type extends MessageType<CallState> {
619
656
  constructor();
620
657
  create(value?: PartialMessage<CallState>): CallState;
@@ -1,17 +1,6 @@
1
- import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
2
- import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
3
- import type { UpdateMuteStatesResponse } from "./signal";
4
- import type { UpdateMuteStatesRequest } from "./signal";
5
- import type { UpdateSubscriptionsResponse } from "./signal";
6
- import type { UpdateSubscriptionsRequest } from "./signal";
7
- import type { ICETrickleResponse } from "./signal";
8
- import type { ICETrickle } from "../models/models";
9
- import type { SendAnswerResponse } from "./signal";
10
- import type { SendAnswerRequest } from "./signal";
11
- import type { SetPublisherResponse } from "./signal";
12
- import type { SetPublisherRequest } from "./signal";
13
- import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
14
- import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
1
+ import type { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from '@protobuf-ts/runtime-rpc';
2
+ import type { ICETrickleResponse, SendAnswerRequest, SendAnswerResponse, SetPublisherRequest, SetPublisherResponse, UpdateMuteStatesRequest, UpdateMuteStatesResponse, UpdateSubscriptionsRequest, UpdateSubscriptionsResponse } from './signal';
3
+ import type { ICETrickle } from '../models/models';
15
4
  /**
16
5
  * @generated from protobuf service stream.video.sfu.signal.SignalServer
17
6
  */
@@ -1,15 +1,7 @@
1
- import { ServiceType } from "@protobuf-ts/runtime-rpc";
2
- import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
3
- import type { IBinaryWriter } from "@protobuf-ts/runtime";
4
- import type { BinaryReadOptions } from "@protobuf-ts/runtime";
5
- import type { IBinaryReader } from "@protobuf-ts/runtime";
6
- import type { PartialMessage } from "@protobuf-ts/runtime";
7
- import { MessageType } from "@protobuf-ts/runtime";
8
- import { TrackInfo } from "../models/models";
9
- import { PeerType } from "../models/models";
10
- import { VideoDimension } from "../models/models";
11
- import { TrackType } from "../models/models";
12
- import { Error } from "../models/models";
1
+ import { Error, PeerType, TrackInfo, TrackType, VideoDimension } from '../models/models';
2
+ import { ServiceType } from '@protobuf-ts/runtime-rpc';
3
+ import type { BinaryReadOptions, BinaryWriteOptions, IBinaryReader, IBinaryWriter, PartialMessage } from '@protobuf-ts/runtime';
4
+ import { MessageType } from '@protobuf-ts/runtime';
13
5
  /**
14
6
  * @generated from protobuf message stream.video.sfu.signal.UpdateMuteStatesRequest
15
7
  */
@@ -1,4 +1,6 @@
1
- import { Logger } from './coordinator/connection/types';
1
+ import { Logger, LogLevel } from './coordinator/connection/types';
2
+ export declare const logLevels: Record<LogLevel, number>;
2
3
  export declare const logToConsole: Logger;
3
- export declare const setLogger: (l: Logger) => void;
4
+ export declare const setLogger: (l: Logger, lvl?: LogLevel) => void;
5
+ export declare const setLogLevel: (l: LogLevel) => void;
4
6
  export declare const getLogger: (withTags?: string[]) => Logger;
@@ -5,8 +5,7 @@ export declare const isSfuEvent: (eventName: SfuEventKinds | CallEventTypes) =>
5
5
  export type SfuEventListener = (event: SfuEvent) => void;
6
6
  export declare class Dispatcher {
7
7
  private subscribers;
8
- private logger?;
9
- constructor();
8
+ private readonly logger;
10
9
  dispatch: (message: SfuEvent) => void;
11
10
  on: (eventName: SfuEventKinds, fn: SfuEventListener) => () => void;
12
11
  off: (eventName: SfuEventKinds, fn: SfuEventListener) => void;