livekit-client 1.6.6 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/dist/livekit-client.esm.mjs +508 -317
  2. package/dist/livekit-client.esm.mjs.map +1 -1
  3. package/dist/livekit-client.umd.js +1 -1
  4. package/dist/livekit-client.umd.js.map +1 -1
  5. package/dist/src/proto/google/protobuf/timestamp.d.ts +9 -2
  6. package/dist/src/proto/google/protobuf/timestamp.d.ts.map +1 -1
  7. package/dist/src/proto/livekit_models.d.ts +958 -58
  8. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  9. package/dist/src/proto/livekit_rtc.d.ts +8394 -3725
  10. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  11. package/dist/src/room/PCTransport.d.ts.map +1 -1
  12. package/dist/src/room/RTCEngine.d.ts +10 -3
  13. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  14. package/dist/src/room/Room.d.ts +1 -1
  15. package/dist/src/room/Room.d.ts.map +1 -1
  16. package/dist/src/room/events.d.ts +1 -1
  17. package/dist/src/room/participant/LocalParticipant.d.ts +18 -0
  18. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  19. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  20. package/dist/src/room/track/RemoteTrackPublication.d.ts +1 -1
  21. package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
  22. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  23. package/dist/src/room/track/Track.d.ts +2 -1
  24. package/dist/src/room/track/Track.d.ts.map +1 -1
  25. package/dist/src/room/track/options.d.ts +10 -2
  26. package/dist/src/room/track/options.d.ts.map +1 -1
  27. package/dist/src/room/types.d.ts +7 -0
  28. package/dist/src/room/types.d.ts.map +1 -1
  29. package/dist/src/version.d.ts +1 -1
  30. package/dist/ts4.2/src/proto/google/protobuf/timestamp.d.ts +11 -2
  31. package/dist/ts4.2/src/proto/livekit_models.d.ts +1199 -177
  32. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +9260 -4023
  33. package/dist/ts4.2/src/room/RTCEngine.d.ts +10 -3
  34. package/dist/ts4.2/src/room/Room.d.ts +1 -1
  35. package/dist/ts4.2/src/room/events.d.ts +1 -1
  36. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +18 -0
  37. package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +1 -1
  38. package/dist/ts4.2/src/room/track/Track.d.ts +2 -1
  39. package/dist/ts4.2/src/room/track/options.d.ts +10 -2
  40. package/dist/ts4.2/src/room/types.d.ts +7 -0
  41. package/dist/ts4.2/src/version.d.ts +1 -1
  42. package/package.json +14 -14
  43. package/src/proto/google/protobuf/timestamp.ts +4 -0
  44. package/src/proto/livekit_models.ts +128 -31
  45. package/src/proto/livekit_rtc.ts +262 -161
  46. package/src/room/PCTransport.ts +2 -0
  47. package/src/room/RTCEngine.ts +50 -55
  48. package/src/room/Room.ts +60 -43
  49. package/src/room/events.ts +1 -1
  50. package/src/room/participant/LocalParticipant.ts +118 -28
  51. package/src/room/participant/RemoteParticipant.ts +2 -3
  52. package/src/room/track/RemoteTrackPublication.ts +3 -2
  53. package/src/room/track/RemoteVideoTrack.ts +0 -3
  54. package/src/room/track/Track.ts +2 -1
  55. package/src/room/track/options.ts +14 -2
  56. package/src/room/types.ts +9 -0
  57. package/src/version.ts +1 -1
@@ -35,7 +35,6 @@ export default class RTCEngine extends RTCEngine_base {
35
35
  private reconnectStart;
36
36
  private fullReconnectOnNext;
37
37
  private clientConfiguration?;
38
- private connectedServerAddr?;
39
38
  private attemptingReconnect;
40
39
  private reconnectPolicy;
41
40
  private reconnectTimeout?;
@@ -45,14 +44,21 @@ export default class RTCEngine extends RTCEngine_base {
45
44
  /** specifies how often an initial join connection is allowed to retry */
46
45
  private maxJoinAttempts;
47
46
  private closingLock;
47
+ private shouldFailNext;
48
48
  constructor(options: InternalRoomOptions);
49
49
  join(url: string, token: string, opts: SignalOptions, abortSignal?: AbortSignal): Promise<JoinResponse>;
50
50
  close(): Promise<void>;
51
51
  addTrack(req: AddTrackRequest): Promise<TrackInfo>;
52
- removeTrack(sender: RTCRtpSender): void;
52
+ /**
53
+ * Removes sender from PeerConnection, returning true if it was removed successfully
54
+ * and a negotiation is necessary
55
+ * @param sender
56
+ * @returns
57
+ */
58
+ removeTrack(sender: RTCRtpSender): boolean;
53
59
  updateMuteStatus(trackSid: string, muted: boolean): void;
54
60
  get dataSubscriberReadyState(): string | undefined;
55
- get connectedServerAddress(): string | undefined;
61
+ getConnectedServerAddress(): Promise<string | undefined>;
56
62
  private configure;
57
63
  private makeRTCConfiguration;
58
64
  private createDataChannels;
@@ -80,6 +86,7 @@ export default class RTCEngine extends RTCEngine_base {
80
86
  /** @internal */
81
87
  negotiate(): Promise<void>;
82
88
  dataChannelForKind(kind: DataPacket_Kind, sub?: boolean): RTCDataChannel | undefined;
89
+ failNext(): void;
83
90
  private clearReconnectTimeout;
84
91
  private clearPendingReconnect;
85
92
  private handleBrowserOnLine;
@@ -207,7 +207,7 @@ export type RoomEventCallbacks = {
207
207
  participantPermissionsChanged: (prevPermissions: ParticipantPermission | undefined, participant: RemoteParticipant | LocalParticipant) => void;
208
208
  activeSpeakersChanged: (speakers: Array<Participant>) => void;
209
209
  roomMetadataChanged: (metadata: string) => void;
210
- dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacket_Kind) => void;
210
+ dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacket_Kind, topic?: string) => void;
211
211
  connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
212
212
  mediaDevicesError: (error: Error) => void;
213
213
  trackStreamStateChanged: (publication: RemoteTrackPublication, streamState: Track.StreamState, participant: RemoteParticipant) => void;
@@ -153,7 +153,7 @@ export declare enum RoomEvent {
153
153
  * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
154
154
  * All participants in the room will receive the messages sent to the room.
155
155
  *
156
- * args: (payload: Uint8Array, participant: [[Participant]], kind: [[DataPacket_Kind]])
156
+ * args: (payload: Uint8Array, participant: [[Participant]], kind: [[DataPacket_Kind]], topic?: string)
157
157
  */
158
158
  DataReceived = "dataReceived",
159
159
  /**
@@ -7,6 +7,7 @@ import LocalTrack from '../track/LocalTrack';
7
7
  import LocalTrackPublication from '../track/LocalTrackPublication';
8
8
  import { AudioCaptureOptions, BackupVideoCodec, CreateLocalTracksOptions, ScreenShareCaptureOptions, TrackPublishOptions, VideoCaptureOptions } from '../track/options';
9
9
  import { Track } from '../track/Track';
10
+ import type { DataPublishOptions } from '../types';
10
11
  import Participant from './Participant';
11
12
  import { ParticipantTrackPermission } from './ParticipantTrackPermission';
12
13
  import RemoteParticipant from './RemoteParticipant';
@@ -18,11 +19,13 @@ export default class LocalParticipant extends Participant {
18
19
  /** @internal */
19
20
  engine: RTCEngine;
20
21
  private pendingPublishing;
22
+ private pendingPublishPromises;
21
23
  private cameraError;
22
24
  private microphoneError;
23
25
  private participantTrackPermissions;
24
26
  private allParticipantsAllowedToSubscribe;
25
27
  private roomOptions;
28
+ private reconnectFuture?;
26
29
  /** @internal */
27
30
  constructor(sid: string, identity: string, engine: RTCEngine, options: InternalRoomOptions);
28
31
  get lastCameraError(): Error | undefined;
@@ -33,6 +36,8 @@ export default class LocalParticipant extends Participant {
33
36
  * @internal
34
37
  */
35
38
  setupEngine(engine: RTCEngine): void;
39
+ private handleReconnecting;
40
+ private handleReconnected;
36
41
  /**
37
42
  * Enable or disable a participant's camera track.
38
43
  *
@@ -81,6 +86,7 @@ export default class LocalParticipant extends Participant {
81
86
  * @param options
82
87
  */
83
88
  publishTrack(track: LocalTrack | MediaStreamTrack, options?: TrackPublishOptions): Promise<LocalTrackPublication>;
89
+ private publish;
84
90
  get isLocal(): boolean;
85
91
  /** @internal
86
92
  * publish additional codec to existing track
@@ -89,6 +95,18 @@ export default class LocalParticipant extends Participant {
89
95
  unpublishTrack(track: LocalTrack | MediaStreamTrack, stopOnUnpublish?: boolean): Promise<LocalTrackPublication | undefined>;
90
96
  unpublishTracks(tracks: LocalTrack[] | MediaStreamTrack[]): Promise<LocalTrackPublication[]>;
91
97
  republishAllTracks(options?: TrackPublishOptions): Promise<void>;
98
+ /**
99
+ * Publish a new data payload to the room. Data will be forwarded to each
100
+ * participant in the room if the destination field in publishOptions is empty
101
+ *
102
+ * @param data Uint8Array of the payload. To send string data, use TextEncoder.encode
103
+ * @param kind whether to send this as reliable or lossy.
104
+ * For data that you need delivery guarantee (such as chat messages), use Reliable.
105
+ * For data that should arrive as quickly as possible, but you are ok with dropped
106
+ * packets, use Lossy.
107
+ * @param publishOptions optionally specify a `topic` and `destination`
108
+ */
109
+ publishData(data: Uint8Array, kind: DataPacket_Kind, publishOptions?: DataPublishOptions): Promise<void>;
92
110
  /**
93
111
  * Publish a new data payload to the room. Data will be forwarded to each
94
112
  * participant in the room if the destination argument is empty
@@ -11,7 +11,7 @@ export default class RemoteTrackPublication extends TrackPublication {
11
11
  protected currentVideoQuality?: VideoQuality;
12
12
  protected videoDimensions?: Track.Dimensions;
13
13
  protected fps?: number;
14
- constructor(kind: Track.Kind, id: string, name: string, autoSubscribe: boolean | undefined);
14
+ constructor(kind: Track.Kind, ti: TrackInfo, autoSubscribe: boolean | undefined);
15
15
  /**
16
16
  * Subscribe or unsubscribe to this remote track
17
17
  * @param subscribed true to subscribe to a track, false to unsubscribe
@@ -17,7 +17,8 @@ export declare abstract class Track extends Track_base {
17
17
  */
18
18
  mediaStream?: MediaStream;
19
19
  /**
20
- * indicates current state of stream
20
+ * indicates current state of stream, it'll indicate `paused` if the track
21
+ * has been paused by congestion controller
21
22
  */
22
23
  streamState: Track.StreamState;
23
24
  protected _mediaStreamTrack: MediaStreamTrack;
@@ -25,11 +25,11 @@ export interface TrackPublishDefaults {
25
25
  */
26
26
  audioBitrate?: number;
27
27
  /**
28
- * dtx (Discontinuous Transmission of audio), defaults to true
28
+ * dtx (Discontinuous Transmission of audio), enabled by default for mono tracks.
29
29
  */
30
30
  dtx?: boolean;
31
31
  /**
32
- * red (Redundant Audio Data), defaults to true
32
+ * red (Redundant Audio Data), enabled by default for mono tracks.
33
33
  */
34
34
  red?: boolean;
35
35
  /**
@@ -114,6 +114,14 @@ export interface ScreenShareCaptureOptions {
114
114
  audio?: boolean | AudioCaptureOptions;
115
115
  /** capture resolution, defaults to full HD */
116
116
  resolution?: VideoResolution;
117
+ /** a CaptureController object instance containing methods that can be used to further manipulate the capture session if included. */
118
+ controller?: unknown;
119
+ /** specifies whether the browser should allow the user to select the current tab for capture */
120
+ selfBrowserSurface?: 'include' | 'exclude';
121
+ /** specifies whether the browser should display a control to allow the user to dynamically switch the shared tab during screen-sharing. */
122
+ surfaceSwitching?: 'include' | 'exclude';
123
+ /** specifies whether the browser should include the system audio among the possible audio sources offered to the user */
124
+ systemAudio?: 'include' | 'exclude';
117
125
  }
118
126
  export interface AudioCaptureOptions {
119
127
  /**
@@ -1,3 +1,4 @@
1
+ import type RemoteParticipant from './participant/RemoteParticipant';
1
2
  export type SimulationOptions = {
2
3
  publish?: {
3
4
  audio?: boolean;
@@ -11,4 +12,10 @@ export type SimulationOptions = {
11
12
  video?: boolean;
12
13
  };
13
14
  };
15
+ export type DataPublishOptions = {
16
+ /** the participants who will receive the message, will be sent to every one if empty */
17
+ destination?: RemoteParticipant[] | string[];
18
+ /** the topic under which the message gets published */
19
+ topic?: string;
20
+ };
14
21
  //# sourceMappingURL=types.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export declare const version: string;
2
- export declare const protocolVersion = 8;
2
+ export declare const protocolVersion = 9;
3
3
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livekit-client",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "JavaScript/TypeScript client SDK for LiveKit",
5
5
  "main": "./dist/livekit-client.umd.js",
6
6
  "unpkg": "./dist/livekit-client.umd.js",
@@ -51,7 +51,7 @@
51
51
  "webrtc-adapter": "^8.1.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@babel/core": "7.20.12",
54
+ "@babel/core": "7.21.0",
55
55
  "@babel/preset-env": "7.20.2",
56
56
  "@changesets/changelog-github": "0.4.8",
57
57
  "@changesets/cli": "2.26.0",
@@ -59,32 +59,32 @@
59
59
  "@rollup/plugin-commonjs": "24.0.1",
60
60
  "@rollup/plugin-json": "6.0.0",
61
61
  "@rollup/plugin-node-resolve": "15.0.1",
62
+ "@rollup/plugin-terser": "^0.4.0",
62
63
  "@types/jest": "29.4.0",
63
64
  "@types/sdp-transform": "2.4.5",
64
65
  "@types/ua-parser-js": "0.7.36",
65
66
  "@types/ws": "8.5.4",
66
- "@typescript-eslint/eslint-plugin": "5.50.0",
67
- "@typescript-eslint/parser": "5.50.0",
67
+ "@typescript-eslint/eslint-plugin": "5.54.0",
68
+ "@typescript-eslint/parser": "5.54.0",
68
69
  "downlevel-dts": "^0.11.0",
69
- "eslint": "8.33.0",
70
+ "eslint": "8.35.0",
70
71
  "eslint-config-airbnb-typescript": "17.0.0",
71
72
  "eslint-config-prettier": "8.6.0",
72
73
  "eslint-plugin-import": "2.27.5",
73
- "gh-pages": "4.0.0",
74
- "jest": "29.4.1",
75
- "prettier": "2.8.3",
76
- "rollup": "3.12.1",
74
+ "gh-pages": "5.0.0",
75
+ "jest": "29.4.3",
76
+ "prettier": "2.8.4",
77
+ "rollup": "3.18.0",
77
78
  "rollup-plugin-delete": "^2.0.0",
78
- "rollup-plugin-filesize": "9.1.2",
79
+ "rollup-plugin-filesize": "10.0.0",
79
80
  "rollup-plugin-re": "1.0.7",
80
- "rollup-plugin-terser": "7.0.2",
81
81
  "rollup-plugin-typescript2": "0.34.1",
82
82
  "ts-jest": "29.0.5",
83
- "ts-proto": "1.139.0",
84
- "typedoc": "0.23.24",
83
+ "ts-proto": "1.140.0",
84
+ "typedoc": "0.23.26",
85
85
  "typedoc-plugin-no-inherit": "1.4.0",
86
86
  "typescript": "4.9.5",
87
- "vite": "4.0.4"
87
+ "vite": "4.1.4"
88
88
  },
89
89
  "browserslist": [
90
90
  "safari >= 11",
@@ -161,6 +161,10 @@ export const Timestamp = {
161
161
  return obj;
162
162
  },
163
163
 
164
+ create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
165
+ return Timestamp.fromPartial(base ?? {});
166
+ },
167
+
164
168
  fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(object: I): Timestamp {
165
169
  const message = createBaseTimestamp();
166
170
  message.seconds = object.seconds ?? 0;
@@ -288,31 +288,31 @@ export function disconnectReasonToJSON(object: DisconnectReason): string {
288
288
  }
289
289
 
290
290
  export enum ReconnectReason {
291
- REASON_UNKOWN = 0,
292
- REASON_SIGNAL_DISCONNECTED = 1,
293
- REASON_PUBLISHER_FAILED = 2,
294
- REASON_SUBSCRIBER_FAILED = 3,
295
- REASON_SWITCH_CANDIDATE = 4,
291
+ RR_UNKOWN = 0,
292
+ RR_SIGNAL_DISCONNECTED = 1,
293
+ RR_PUBLISHER_FAILED = 2,
294
+ RR_SUBSCRIBER_FAILED = 3,
295
+ RR_SWITCH_CANDIDATE = 4,
296
296
  UNRECOGNIZED = -1,
297
297
  }
298
298
 
299
299
  export function reconnectReasonFromJSON(object: any): ReconnectReason {
300
300
  switch (object) {
301
301
  case 0:
302
- case "REASON_UNKOWN":
303
- return ReconnectReason.REASON_UNKOWN;
302
+ case "RR_UNKOWN":
303
+ return ReconnectReason.RR_UNKOWN;
304
304
  case 1:
305
- case "REASON_SIGNAL_DISCONNECTED":
306
- return ReconnectReason.REASON_SIGNAL_DISCONNECTED;
305
+ case "RR_SIGNAL_DISCONNECTED":
306
+ return ReconnectReason.RR_SIGNAL_DISCONNECTED;
307
307
  case 2:
308
- case "REASON_PUBLISHER_FAILED":
309
- return ReconnectReason.REASON_PUBLISHER_FAILED;
308
+ case "RR_PUBLISHER_FAILED":
309
+ return ReconnectReason.RR_PUBLISHER_FAILED;
310
310
  case 3:
311
- case "REASON_SUBSCRIBER_FAILED":
312
- return ReconnectReason.REASON_SUBSCRIBER_FAILED;
311
+ case "RR_SUBSCRIBER_FAILED":
312
+ return ReconnectReason.RR_SUBSCRIBER_FAILED;
313
313
  case 4:
314
- case "REASON_SWITCH_CANDIDATE":
315
- return ReconnectReason.REASON_SWITCH_CANDIDATE;
314
+ case "RR_SWITCH_CANDIDATE":
315
+ return ReconnectReason.RR_SWITCH_CANDIDATE;
316
316
  case -1:
317
317
  case "UNRECOGNIZED":
318
318
  default:
@@ -322,16 +322,16 @@ export function reconnectReasonFromJSON(object: any): ReconnectReason {
322
322
 
323
323
  export function reconnectReasonToJSON(object: ReconnectReason): string {
324
324
  switch (object) {
325
- case ReconnectReason.REASON_UNKOWN:
326
- return "REASON_UNKOWN";
327
- case ReconnectReason.REASON_SIGNAL_DISCONNECTED:
328
- return "REASON_SIGNAL_DISCONNECTED";
329
- case ReconnectReason.REASON_PUBLISHER_FAILED:
330
- return "REASON_PUBLISHER_FAILED";
331
- case ReconnectReason.REASON_SUBSCRIBER_FAILED:
332
- return "REASON_SUBSCRIBER_FAILED";
333
- case ReconnectReason.REASON_SWITCH_CANDIDATE:
334
- return "REASON_SWITCH_CANDIDATE";
325
+ case ReconnectReason.RR_UNKOWN:
326
+ return "RR_UNKOWN";
327
+ case ReconnectReason.RR_SIGNAL_DISCONNECTED:
328
+ return "RR_SIGNAL_DISCONNECTED";
329
+ case ReconnectReason.RR_PUBLISHER_FAILED:
330
+ return "RR_PUBLISHER_FAILED";
331
+ case ReconnectReason.RR_SUBSCRIBER_FAILED:
332
+ return "RR_SUBSCRIBER_FAILED";
333
+ case ReconnectReason.RR_SWITCH_CANDIDATE:
334
+ return "RR_SWITCH_CANDIDATE";
335
335
  case ReconnectReason.UNRECOGNIZED:
336
336
  default:
337
337
  return "UNRECOGNIZED";
@@ -586,6 +586,8 @@ export interface UserPacket {
586
586
  payload: Uint8Array;
587
587
  /** the ID of the participants who will receive the message (the message will be sent to all the people in the room if this variable is empty) */
588
588
  destinationSids: string[];
589
+ /** topic under which the message was published */
590
+ topic?: string | undefined;
589
591
  }
590
592
 
591
593
  export interface ParticipantTracks {
@@ -918,6 +920,10 @@ export const Room = {
918
920
  return obj;
919
921
  },
920
922
 
923
+ create<I extends Exact<DeepPartial<Room>, I>>(base?: I): Room {
924
+ return Room.fromPartial(base ?? {});
925
+ },
926
+
921
927
  fromPartial<I extends Exact<DeepPartial<Room>, I>>(object: I): Room {
922
928
  const message = createBaseRoom();
923
929
  message.sid = object.sid ?? "";
@@ -984,6 +990,10 @@ export const Codec = {
984
990
  return obj;
985
991
  },
986
992
 
993
+ create<I extends Exact<DeepPartial<Codec>, I>>(base?: I): Codec {
994
+ return Codec.fromPartial(base ?? {});
995
+ },
996
+
987
997
  fromPartial<I extends Exact<DeepPartial<Codec>, I>>(object: I): Codec {
988
998
  const message = createBaseCodec();
989
999
  message.mime = object.mime ?? "";
@@ -1096,6 +1106,10 @@ export const ParticipantPermission = {
1096
1106
  return obj;
1097
1107
  },
1098
1108
 
1109
+ create<I extends Exact<DeepPartial<ParticipantPermission>, I>>(base?: I): ParticipantPermission {
1110
+ return ParticipantPermission.fromPartial(base ?? {});
1111
+ },
1112
+
1099
1113
  fromPartial<I extends Exact<DeepPartial<ParticipantPermission>, I>>(object: I): ParticipantPermission {
1100
1114
  const message = createBaseParticipantPermission();
1101
1115
  message.canSubscribe = object.canSubscribe ?? false;
@@ -1247,6 +1261,10 @@ export const ParticipantInfo = {
1247
1261
  return obj;
1248
1262
  },
1249
1263
 
1264
+ create<I extends Exact<DeepPartial<ParticipantInfo>, I>>(base?: I): ParticipantInfo {
1265
+ return ParticipantInfo.fromPartial(base ?? {});
1266
+ },
1267
+
1250
1268
  fromPartial<I extends Exact<DeepPartial<ParticipantInfo>, I>>(object: I): ParticipantInfo {
1251
1269
  const message = createBaseParticipantInfo();
1252
1270
  message.sid = object.sid ?? "";
@@ -1299,6 +1317,10 @@ export const Encryption = {
1299
1317
  return obj;
1300
1318
  },
1301
1319
 
1320
+ create<I extends Exact<DeepPartial<Encryption>, I>>(base?: I): Encryption {
1321
+ return Encryption.fromPartial(base ?? {});
1322
+ },
1323
+
1302
1324
  fromPartial<I extends Exact<DeepPartial<Encryption>, I>>(_: I): Encryption {
1303
1325
  const message = createBaseEncryption();
1304
1326
  return message;
@@ -1375,6 +1397,10 @@ export const SimulcastCodecInfo = {
1375
1397
  return obj;
1376
1398
  },
1377
1399
 
1400
+ create<I extends Exact<DeepPartial<SimulcastCodecInfo>, I>>(base?: I): SimulcastCodecInfo {
1401
+ return SimulcastCodecInfo.fromPartial(base ?? {});
1402
+ },
1403
+
1378
1404
  fromPartial<I extends Exact<DeepPartial<SimulcastCodecInfo>, I>>(object: I): SimulcastCodecInfo {
1379
1405
  const message = createBaseSimulcastCodecInfo();
1380
1406
  message.mimeType = object.mimeType ?? "";
@@ -1572,6 +1598,10 @@ export const TrackInfo = {
1572
1598
  return obj;
1573
1599
  },
1574
1600
 
1601
+ create<I extends Exact<DeepPartial<TrackInfo>, I>>(base?: I): TrackInfo {
1602
+ return TrackInfo.fromPartial(base ?? {});
1603
+ },
1604
+
1575
1605
  fromPartial<I extends Exact<DeepPartial<TrackInfo>, I>>(object: I): TrackInfo {
1576
1606
  const message = createBaseTrackInfo();
1577
1607
  message.sid = object.sid ?? "";
@@ -1668,6 +1698,10 @@ export const VideoLayer = {
1668
1698
  return obj;
1669
1699
  },
1670
1700
 
1701
+ create<I extends Exact<DeepPartial<VideoLayer>, I>>(base?: I): VideoLayer {
1702
+ return VideoLayer.fromPartial(base ?? {});
1703
+ },
1704
+
1671
1705
  fromPartial<I extends Exact<DeepPartial<VideoLayer>, I>>(object: I): VideoLayer {
1672
1706
  const message = createBaseVideoLayer();
1673
1707
  message.quality = object.quality ?? 0;
@@ -1688,11 +1722,13 @@ export const DataPacket = {
1688
1722
  if (message.kind !== 0) {
1689
1723
  writer.uint32(8).int32(message.kind);
1690
1724
  }
1691
- if (message.value?.$case === "user") {
1692
- UserPacket.encode(message.value.user, writer.uint32(18).fork()).ldelim();
1693
- }
1694
- if (message.value?.$case === "speaker") {
1695
- ActiveSpeakerUpdate.encode(message.value.speaker, writer.uint32(26).fork()).ldelim();
1725
+ switch (message.value?.$case) {
1726
+ case "user":
1727
+ UserPacket.encode(message.value.user, writer.uint32(18).fork()).ldelim();
1728
+ break;
1729
+ case "speaker":
1730
+ ActiveSpeakerUpdate.encode(message.value.speaker, writer.uint32(26).fork()).ldelim();
1731
+ break;
1696
1732
  }
1697
1733
  return writer;
1698
1734
  },
@@ -1742,6 +1778,10 @@ export const DataPacket = {
1742
1778
  return obj;
1743
1779
  },
1744
1780
 
1781
+ create<I extends Exact<DeepPartial<DataPacket>, I>>(base?: I): DataPacket {
1782
+ return DataPacket.fromPartial(base ?? {});
1783
+ },
1784
+
1745
1785
  fromPartial<I extends Exact<DeepPartial<DataPacket>, I>>(object: I): DataPacket {
1746
1786
  const message = createBaseDataPacket();
1747
1787
  message.kind = object.kind ?? 0;
@@ -1801,6 +1841,10 @@ export const ActiveSpeakerUpdate = {
1801
1841
  return obj;
1802
1842
  },
1803
1843
 
1844
+ create<I extends Exact<DeepPartial<ActiveSpeakerUpdate>, I>>(base?: I): ActiveSpeakerUpdate {
1845
+ return ActiveSpeakerUpdate.fromPartial(base ?? {});
1846
+ },
1847
+
1804
1848
  fromPartial<I extends Exact<DeepPartial<ActiveSpeakerUpdate>, I>>(object: I): ActiveSpeakerUpdate {
1805
1849
  const message = createBaseActiveSpeakerUpdate();
1806
1850
  message.speakers = object.speakers?.map((e) => SpeakerInfo.fromPartial(e)) || [];
@@ -1866,6 +1910,10 @@ export const SpeakerInfo = {
1866
1910
  return obj;
1867
1911
  },
1868
1912
 
1913
+ create<I extends Exact<DeepPartial<SpeakerInfo>, I>>(base?: I): SpeakerInfo {
1914
+ return SpeakerInfo.fromPartial(base ?? {});
1915
+ },
1916
+
1869
1917
  fromPartial<I extends Exact<DeepPartial<SpeakerInfo>, I>>(object: I): SpeakerInfo {
1870
1918
  const message = createBaseSpeakerInfo();
1871
1919
  message.sid = object.sid ?? "";
@@ -1876,7 +1924,7 @@ export const SpeakerInfo = {
1876
1924
  };
1877
1925
 
1878
1926
  function createBaseUserPacket(): UserPacket {
1879
- return { participantSid: "", payload: new Uint8Array(), destinationSids: [] };
1927
+ return { participantSid: "", payload: new Uint8Array(), destinationSids: [], topic: undefined };
1880
1928
  }
1881
1929
 
1882
1930
  export const UserPacket = {
@@ -1890,6 +1938,9 @@ export const UserPacket = {
1890
1938
  for (const v of message.destinationSids) {
1891
1939
  writer.uint32(26).string(v!);
1892
1940
  }
1941
+ if (message.topic !== undefined) {
1942
+ writer.uint32(34).string(message.topic);
1943
+ }
1893
1944
  return writer;
1894
1945
  },
1895
1946
 
@@ -1909,6 +1960,9 @@ export const UserPacket = {
1909
1960
  case 3:
1910
1961
  message.destinationSids.push(reader.string());
1911
1962
  break;
1963
+ case 4:
1964
+ message.topic = reader.string();
1965
+ break;
1912
1966
  default:
1913
1967
  reader.skipType(tag & 7);
1914
1968
  break;
@@ -1922,6 +1976,7 @@ export const UserPacket = {
1922
1976
  participantSid: isSet(object.participantSid) ? String(object.participantSid) : "",
1923
1977
  payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(),
1924
1978
  destinationSids: Array.isArray(object?.destinationSids) ? object.destinationSids.map((e: any) => String(e)) : [],
1979
+ topic: isSet(object.topic) ? String(object.topic) : undefined,
1925
1980
  };
1926
1981
  },
1927
1982
 
@@ -1935,14 +1990,20 @@ export const UserPacket = {
1935
1990
  } else {
1936
1991
  obj.destinationSids = [];
1937
1992
  }
1993
+ message.topic !== undefined && (obj.topic = message.topic);
1938
1994
  return obj;
1939
1995
  },
1940
1996
 
1997
+ create<I extends Exact<DeepPartial<UserPacket>, I>>(base?: I): UserPacket {
1998
+ return UserPacket.fromPartial(base ?? {});
1999
+ },
2000
+
1941
2001
  fromPartial<I extends Exact<DeepPartial<UserPacket>, I>>(object: I): UserPacket {
1942
2002
  const message = createBaseUserPacket();
1943
2003
  message.participantSid = object.participantSid ?? "";
1944
2004
  message.payload = object.payload ?? new Uint8Array();
1945
2005
  message.destinationSids = object.destinationSids?.map((e) => e) || [];
2006
+ message.topic = object.topic ?? undefined;
1946
2007
  return message;
1947
2008
  },
1948
2009
  };
@@ -2001,6 +2062,10 @@ export const ParticipantTracks = {
2001
2062
  return obj;
2002
2063
  },
2003
2064
 
2065
+ create<I extends Exact<DeepPartial<ParticipantTracks>, I>>(base?: I): ParticipantTracks {
2066
+ return ParticipantTracks.fromPartial(base ?? {});
2067
+ },
2068
+
2004
2069
  fromPartial<I extends Exact<DeepPartial<ParticipantTracks>, I>>(object: I): ParticipantTracks {
2005
2070
  const message = createBaseParticipantTracks();
2006
2071
  message.participantSid = object.participantSid ?? "";
@@ -2091,6 +2156,10 @@ export const ServerInfo = {
2091
2156
  return obj;
2092
2157
  },
2093
2158
 
2159
+ create<I extends Exact<DeepPartial<ServerInfo>, I>>(base?: I): ServerInfo {
2160
+ return ServerInfo.fromPartial(base ?? {});
2161
+ },
2162
+
2094
2163
  fromPartial<I extends Exact<DeepPartial<ServerInfo>, I>>(object: I): ServerInfo {
2095
2164
  const message = createBaseServerInfo();
2096
2165
  message.edition = object.edition ?? 0;
@@ -2228,6 +2297,10 @@ export const ClientInfo = {
2228
2297
  return obj;
2229
2298
  },
2230
2299
 
2300
+ create<I extends Exact<DeepPartial<ClientInfo>, I>>(base?: I): ClientInfo {
2301
+ return ClientInfo.fromPartial(base ?? {});
2302
+ },
2303
+
2231
2304
  fromPartial<I extends Exact<DeepPartial<ClientInfo>, I>>(object: I): ClientInfo {
2232
2305
  const message = createBaseClientInfo();
2233
2306
  message.sdk = object.sdk ?? 0;
@@ -2321,6 +2394,10 @@ export const ClientConfiguration = {
2321
2394
  return obj;
2322
2395
  },
2323
2396
 
2397
+ create<I extends Exact<DeepPartial<ClientConfiguration>, I>>(base?: I): ClientConfiguration {
2398
+ return ClientConfiguration.fromPartial(base ?? {});
2399
+ },
2400
+
2324
2401
  fromPartial<I extends Exact<DeepPartial<ClientConfiguration>, I>>(object: I): ClientConfiguration {
2325
2402
  const message = createBaseClientConfiguration();
2326
2403
  message.video = (object.video !== undefined && object.video !== null)
@@ -2378,6 +2455,10 @@ export const VideoConfiguration = {
2378
2455
  return obj;
2379
2456
  },
2380
2457
 
2458
+ create<I extends Exact<DeepPartial<VideoConfiguration>, I>>(base?: I): VideoConfiguration {
2459
+ return VideoConfiguration.fromPartial(base ?? {});
2460
+ },
2461
+
2381
2462
  fromPartial<I extends Exact<DeepPartial<VideoConfiguration>, I>>(object: I): VideoConfiguration {
2382
2463
  const message = createBaseVideoConfiguration();
2383
2464
  message.hardwareEncoder = object.hardwareEncoder ?? 0;
@@ -2429,6 +2510,10 @@ export const DisabledCodecs = {
2429
2510
  return obj;
2430
2511
  },
2431
2512
 
2513
+ create<I extends Exact<DeepPartial<DisabledCodecs>, I>>(base?: I): DisabledCodecs {
2514
+ return DisabledCodecs.fromPartial(base ?? {});
2515
+ },
2516
+
2432
2517
  fromPartial<I extends Exact<DeepPartial<DisabledCodecs>, I>>(object: I): DisabledCodecs {
2433
2518
  const message = createBaseDisabledCodecs();
2434
2519
  message.codecs = object.codecs?.map((e) => Codec.fromPartial(e)) || [];
@@ -2853,6 +2938,10 @@ export const RTPStats = {
2853
2938
  return obj;
2854
2939
  },
2855
2940
 
2941
+ create<I extends Exact<DeepPartial<RTPStats>, I>>(base?: I): RTPStats {
2942
+ return RTPStats.fromPartial(base ?? {});
2943
+ },
2944
+
2856
2945
  fromPartial<I extends Exact<DeepPartial<RTPStats>, I>>(object: I): RTPStats {
2857
2946
  const message = createBaseRTPStats();
2858
2947
  message.startTime = object.startTime ?? undefined;
@@ -2955,6 +3044,10 @@ export const RTPStats_GapHistogramEntry = {
2955
3044
  return obj;
2956
3045
  },
2957
3046
 
3047
+ create<I extends Exact<DeepPartial<RTPStats_GapHistogramEntry>, I>>(base?: I): RTPStats_GapHistogramEntry {
3048
+ return RTPStats_GapHistogramEntry.fromPartial(base ?? {});
3049
+ },
3050
+
2958
3051
  fromPartial<I extends Exact<DeepPartial<RTPStats_GapHistogramEntry>, I>>(object: I): RTPStats_GapHistogramEntry {
2959
3052
  const message = createBaseRTPStats_GapHistogramEntry();
2960
3053
  message.key = object.key ?? 0;
@@ -3013,6 +3106,10 @@ export const TimedVersion = {
3013
3106
  return obj;
3014
3107
  },
3015
3108
 
3109
+ create<I extends Exact<DeepPartial<TimedVersion>, I>>(base?: I): TimedVersion {
3110
+ return TimedVersion.fromPartial(base ?? {});
3111
+ },
3112
+
3016
3113
  fromPartial<I extends Exact<DeepPartial<TimedVersion>, I>>(object: I): TimedVersion {
3017
3114
  const message = createBaseTimedVersion();
3018
3115
  message.unixMicro = object.unixMicro ?? 0;