livekit-client 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/README.md +3 -2
  2. package/dist/livekit-client.esm.mjs +13470 -13341
  3. package/dist/livekit-client.esm.mjs.map +1 -1
  4. package/dist/livekit-client.umd.js +1 -1
  5. package/dist/livekit-client.umd.js.map +1 -1
  6. package/dist/src/api/SignalClient.d.ts +11 -10
  7. package/dist/src/api/SignalClient.d.ts.map +1 -1
  8. package/dist/src/connectionHelper/ConnectionCheck.d.ts +1 -1
  9. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  10. package/dist/src/connectionHelper/checks/Checker.d.ts +1 -1
  11. package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
  12. package/dist/src/index.d.ts +5 -7
  13. package/dist/src/index.d.ts.map +1 -1
  14. package/dist/src/proto/livekit_models.d.ts +5 -0
  15. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  16. package/dist/src/proto/livekit_rtc.d.ts +32 -0
  17. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  18. package/dist/src/room/RTCEngine.d.ts +5 -3
  19. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  20. package/dist/src/room/Room.d.ts +19 -15
  21. package/dist/src/room/Room.d.ts.map +1 -1
  22. package/dist/src/room/events.d.ts +15 -0
  23. package/dist/src/room/events.d.ts.map +1 -1
  24. package/dist/src/room/participant/LocalParticipant.d.ts +14 -2
  25. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  26. package/dist/src/room/participant/Participant.d.ts +4 -2
  27. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  28. package/dist/src/room/participant/RemoteParticipant.d.ts +2 -2
  29. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  30. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  31. package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
  32. package/dist/src/room/track/LocalTrack.d.ts +1 -1
  33. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  34. package/dist/src/room/track/LocalTrackPublication.d.ts +1 -1
  35. package/dist/src/room/track/LocalTrackPublication.d.ts.map +1 -1
  36. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  37. package/dist/src/room/track/RemoteAudioTrack.d.ts +1 -1
  38. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  39. package/dist/src/room/track/create.d.ts.map +1 -1
  40. package/dist/src/room/types.d.ts +1 -0
  41. package/dist/src/room/types.d.ts.map +1 -1
  42. package/dist/ts4.2/src/api/SignalClient.d.ts +14 -10
  43. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +1 -1
  44. package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +1 -1
  45. package/dist/ts4.2/src/index.d.ts +6 -7
  46. package/dist/ts4.2/src/proto/livekit_models.d.ts +5 -0
  47. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +32 -0
  48. package/dist/ts4.2/src/room/RTCEngine.d.ts +5 -3
  49. package/dist/ts4.2/src/room/Room.d.ts +19 -15
  50. package/dist/ts4.2/src/room/events.d.ts +15 -0
  51. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +14 -2
  52. package/dist/ts4.2/src/room/participant/Participant.d.ts +4 -2
  53. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -2
  54. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +1 -1
  55. package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +1 -1
  56. package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +1 -1
  57. package/dist/ts4.2/src/room/types.d.ts +1 -0
  58. package/package.json +4 -3
  59. package/src/api/SignalClient.ts +38 -26
  60. package/src/connectionHelper/ConnectionCheck.ts +1 -2
  61. package/src/connectionHelper/checks/Checker.ts +1 -1
  62. package/src/connectionHelper/checks/reconnect.ts +1 -1
  63. package/src/index.ts +8 -10
  64. package/src/proto/livekit_models.ts +15 -0
  65. package/src/room/RTCEngine.ts +32 -11
  66. package/src/room/RegionUrlProvider.ts +1 -1
  67. package/src/room/Room.ts +102 -70
  68. package/src/room/events.ts +17 -0
  69. package/src/room/participant/LocalParticipant.ts +30 -7
  70. package/src/room/participant/Participant.ts +27 -3
  71. package/src/room/participant/RemoteParticipant.ts +6 -3
  72. package/src/room/participant/publishUtils.test.ts +1 -1
  73. package/src/room/participant/publishUtils.ts +1 -1
  74. package/src/room/track/LocalAudioTrack.ts +1 -1
  75. package/src/room/track/LocalTrack.ts +2 -2
  76. package/src/room/track/LocalTrackPublication.ts +1 -1
  77. package/src/room/track/LocalVideoTrack.ts +3 -3
  78. package/src/room/track/RemoteAudioTrack.ts +1 -1
  79. package/src/room/track/RemoteVideoTrack.test.ts +1 -1
  80. package/src/room/track/RemoteVideoTrack.ts +3 -3
  81. package/src/room/track/create.ts +2 -2
  82. package/src/room/types.ts +11 -0
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/room/track/create.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AAInB;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CA2C5B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAwC5B"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/room/track/create.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AAGnB;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CA2C5B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAwC5B"}
@@ -22,4 +22,5 @@ export type LiveKitReactNativeInfo = {
22
22
  platform: 'ios' | 'android' | 'windows' | 'macos' | 'web' | 'native';
23
23
  devicePixelRatio: number;
24
24
  };
25
+ export type SimulationScenario = 'signal-reconnect' | 'speaker' | 'node-failure' | 'server-leave' | 'migration' | 'resume-reconnect' | 'force-tcp' | 'force-tls' | 'full-reconnect';
25
26
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/room/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,iCAAiC,CAAC;AAErE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,YAAY,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,wFAAwF;IACxF,WAAW,CAAC,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IAEnC,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACrE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/room/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,iCAAiC,CAAC;AAErE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,YAAY,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,wFAAwF;IACxF,WAAW,CAAC,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IAEnC,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACrE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,SAAS,GACT,cAAc,GACd,cAAc,GACd,WAAW,GACX,kBAAkB,GAClB,WAAW,GACX,WAAW,GACX,gBAAgB,CAAC"}
@@ -64,17 +64,21 @@ export declare class SignalClient {
64
64
  connect(url: string, token: string, opts: ConnectOpts, abortSignal?: AbortSignal): Promise<JoinResponse | ReconnectResponse | void>;
65
65
  close(): Promise<void>;
66
66
  sendOffer(offer: RTCSessionDescriptionInit): void;
67
- sendAnswer(answer: RTCSessionDescriptionInit): void;
68
- sendIceCandidate(candidate: RTCIceCandidateInit, target: SignalTarget): void;
69
- sendMuteTrack(trackSid: string, muted: boolean): void;
70
- sendAddTrack(req: AddTrackRequest): void;
67
+ sendAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
68
+ sendIceCandidate(candidate: RTCIceCandidateInit, target: SignalTarget): Promise<void>;
69
+ sendMuteTrack(trackSid: string, muted: boolean): Promise<void>;
70
+ sendAddTrack(req: AddTrackRequest): Promise<void>;
71
+ sendUpdateLocalMetadata(metadata: string, name: string): Promise<void>;
71
72
  sendUpdateTrackSettings(settings: UpdateTrackSettings): void;
72
- sendUpdateSubscription(sub: UpdateSubscription): void;
73
- sendSyncState(sync: SyncState): void;
74
- sendUpdateVideoLayers(trackSid: string, layers: VideoLayer[]): void;
75
- sendUpdateSubscriptionPermissions(allParticipants: boolean, trackPermissions: TrackPermission[]): void;
76
- sendSimulateScenario(scenario: SimulateScenario): void;
77
- sendPing(): void;
73
+ sendUpdateSubscription(sub: UpdateSubscription): Promise<void>;
74
+ sendSyncState(sync: SyncState): Promise<void>;
75
+ sendUpdateVideoLayers(trackSid: string, layers: VideoLayer[]): Promise<void>;
76
+ sendUpdateSubscriptionPermissions(allParticipants: boolean, trackPermissions: TrackPermission[]): Promise<void>;
77
+ sendSimulateScenario(scenario: SimulateScenario): Promise<void>;
78
+ sendPing(): Promise<[
79
+ void,
80
+ void
81
+ ]>;
78
82
  sendLeave(): Promise<void>;
79
83
  sendRequest(message: SignalMessage, fromQueue?: boolean): Promise<void>;
80
84
  private handleSignalResponse;
@@ -1,5 +1,5 @@
1
1
  import type TypedEmitter from 'typed-emitter';
2
- import { Checker, CheckInfo, CheckStatus, InstantiableCheck } from './checks/Checker';
2
+ import { CheckInfo, CheckStatus, Checker, InstantiableCheck } from './checks/Checker';
3
3
  export type { CheckInfo, CheckStatus };
4
4
  declare const ConnectionCheck_base: new () => TypedEmitter<ConnectionCheckCallbacks>;
5
5
  export declare class ConnectionCheck extends ConnectionCheck_base {
@@ -1,7 +1,7 @@
1
1
  import type TypedEmitter from 'typed-emitter';
2
2
  import type { RoomConnectOptions, RoomOptions } from '../../options';
3
- import Room from '../../room/Room';
4
3
  import type RTCEngine from '../../room/RTCEngine';
4
+ import Room from '../../room/Room';
5
5
  type LogMessage = {
6
6
  level: 'info' | 'warning' | 'error';
7
7
  message: string;
@@ -1,11 +1,12 @@
1
1
  import { LogLevel, setLogExtension, setLogLevel } from './logger';
2
2
  import { DataPacket_Kind, DisconnectReason, VideoQuality } from './proto/livekit_models';
3
3
  import DefaultReconnectPolicy from './room/DefaultReconnectPolicy';
4
+ import Room, { ConnectionState, RoomState } from './room/Room';
4
5
  import LocalParticipant from './room/participant/LocalParticipant';
5
6
  import Participant, { ConnectionQuality } from './room/participant/Participant';
6
7
  import type { ParticipantTrackPermission } from './room/participant/ParticipantTrackPermission';
7
8
  import RemoteParticipant from './room/participant/RemoteParticipant';
8
- import Room, { ConnectionState, RoomState } from './room/Room';
9
+ import CriticalTimers from './room/timers';
9
10
  import LocalAudioTrack from './room/track/LocalAudioTrack';
10
11
  import LocalTrack from './room/track/LocalTrack';
11
12
  import LocalTrackPublication from './room/track/LocalTrackPublication';
@@ -13,17 +14,15 @@ import LocalVideoTrack from './room/track/LocalVideoTrack';
13
14
  import RemoteAudioTrack from './room/track/RemoteAudioTrack';
14
15
  import RemoteTrack from './room/track/RemoteTrack';
15
16
  import RemoteTrackPublication from './room/track/RemoteTrackPublication';
16
- import RemoteVideoTrack from './room/track/RemoteVideoTrack';
17
- import type { ElementInfo } from './room/track/RemoteVideoTrack';
17
+ import type RemoteVideoTrack, { ElementInfo } from './room/track/RemoteVideoTrack';
18
18
  import { TrackPublication } from './room/track/TrackPublication';
19
- import CriticalTimers from './room/timers';
20
- import { getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, isBrowserSupported, supportsAdaptiveStream, supportsAV1, supportsDynacast, createAudioAnalyser } from './room/utils';
21
- import type { AudioAnalyserOptions } from './room/utils';
22
19
  import type { LiveKitReactNativeInfo } from './room/types';
20
+ import type { AudioAnalyserOptions } from './room/utils';
21
+ import { createAudioAnalyser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, isBrowserSupported, supportsAV1, supportsAdaptiveStream, supportsDynacast } from './room/utils';
23
22
  export * from './options';
24
23
  export * from './room/errors';
25
24
  export * from './room/events';
26
- export type { DataPublishOptions } from './room/types';
25
+ export type { DataPublishOptions, SimulationScenario } from './room/types';
27
26
  export * from './room/track/create';
28
27
  export * from './room/track/options';
29
28
  export * from './room/track/Track';
@@ -94,6 +94,7 @@ export interface Room {
94
94
  enabledCodecs: Codec[];
95
95
  metadata: string;
96
96
  numParticipants: number;
97
+ numPublishers: number;
97
98
  activeRecording: boolean;
98
99
  }
99
100
  export interface Codec {
@@ -374,6 +375,7 @@ export declare const Room: {
374
375
  }[] | undefined;
375
376
  metadata?: string | undefined;
376
377
  numParticipants?: number | undefined;
378
+ numPublishers?: number | undefined;
377
379
  activeRecording?: boolean | undefined;
378
380
  } & {
379
381
  sid?: string | undefined;
@@ -401,6 +403,7 @@ export declare const Room: {
401
403
  }) | undefined;
402
404
  metadata?: string | undefined;
403
405
  numParticipants?: number | undefined;
406
+ numPublishers?: number | undefined;
404
407
  activeRecording?: boolean | undefined;
405
408
  } & {
406
409
  [K_2 in Exclude<keyof I, keyof Room>]: never;
@@ -418,6 +421,7 @@ export declare const Room: {
418
421
  }[] | undefined;
419
422
  metadata?: string | undefined;
420
423
  numParticipants?: number | undefined;
424
+ numPublishers?: number | undefined;
421
425
  activeRecording?: boolean | undefined;
422
426
  } & {
423
427
  sid?: string | undefined;
@@ -445,6 +449,7 @@ export declare const Room: {
445
449
  }) | undefined;
446
450
  metadata?: string | undefined;
447
451
  numParticipants?: number | undefined;
452
+ numPublishers?: number | undefined;
448
453
  activeRecording?: boolean | undefined;
449
454
  } & {
450
455
  [K_5 in Exclude<keyof I_1, keyof Room>]: never;
@@ -2986,6 +2986,7 @@ export declare const SignalResponse: {
2986
2986
  }[] | undefined;
2987
2987
  metadata?: string | undefined;
2988
2988
  numParticipants?: number | undefined;
2989
+ numPublishers?: number | undefined;
2989
2990
  activeRecording?: boolean | undefined;
2990
2991
  } | undefined;
2991
2992
  participant?: {
@@ -3297,6 +3298,7 @@ export declare const SignalResponse: {
3297
3298
  }[] | undefined;
3298
3299
  metadata?: string | undefined;
3299
3300
  numParticipants?: number | undefined;
3301
+ numPublishers?: number | undefined;
3300
3302
  activeRecording?: boolean | undefined;
3301
3303
  } | undefined;
3302
3304
  } | undefined;
@@ -3411,6 +3413,7 @@ export declare const SignalResponse: {
3411
3413
  }[] | undefined;
3412
3414
  metadata?: string | undefined;
3413
3415
  numParticipants?: number | undefined;
3416
+ numPublishers?: number | undefined;
3414
3417
  activeRecording?: boolean | undefined;
3415
3418
  } | undefined;
3416
3419
  participant?: {
@@ -3576,6 +3579,7 @@ export declare const SignalResponse: {
3576
3579
  }[] | undefined;
3577
3580
  metadata?: string | undefined;
3578
3581
  numParticipants?: number | undefined;
3582
+ numPublishers?: number | undefined;
3579
3583
  activeRecording?: boolean | undefined;
3580
3584
  } | undefined;
3581
3585
  participant?: {
@@ -3737,6 +3741,7 @@ export declare const SignalResponse: {
3737
3741
  }[] | undefined;
3738
3742
  metadata?: string | undefined;
3739
3743
  numParticipants?: number | undefined;
3744
+ numPublishers?: number | undefined;
3740
3745
  activeRecording?: boolean | undefined;
3741
3746
  } & {
3742
3747
  sid?: string | undefined;
@@ -3764,6 +3769,7 @@ export declare const SignalResponse: {
3764
3769
  }) | undefined;
3765
3770
  metadata?: string | undefined;
3766
3771
  numParticipants?: number | undefined;
3772
+ numPublishers?: number | undefined;
3767
3773
  activeRecording?: boolean | undefined;
3768
3774
  } & {
3769
3775
  [K_2 in Exclude<keyof I["message"]["join"]["room"], keyof Room>]: never;
@@ -5554,6 +5560,7 @@ export declare const SignalResponse: {
5554
5560
  }[] | undefined;
5555
5561
  metadata?: string | undefined;
5556
5562
  numParticipants?: number | undefined;
5563
+ numPublishers?: number | undefined;
5557
5564
  activeRecording?: boolean | undefined;
5558
5565
  } | undefined;
5559
5566
  } | undefined;
@@ -5574,6 +5581,7 @@ export declare const SignalResponse: {
5574
5581
  }[] | undefined;
5575
5582
  metadata?: string | undefined;
5576
5583
  numParticipants?: number | undefined;
5584
+ numPublishers?: number | undefined;
5577
5585
  activeRecording?: boolean | undefined;
5578
5586
  } | undefined;
5579
5587
  } & {
@@ -5590,6 +5598,7 @@ export declare const SignalResponse: {
5590
5598
  }[] | undefined;
5591
5599
  metadata?: string | undefined;
5592
5600
  numParticipants?: number | undefined;
5601
+ numPublishers?: number | undefined;
5593
5602
  activeRecording?: boolean | undefined;
5594
5603
  } & {
5595
5604
  sid?: string | undefined;
@@ -5617,6 +5626,7 @@ export declare const SignalResponse: {
5617
5626
  }) | undefined;
5618
5627
  metadata?: string | undefined;
5619
5628
  numParticipants?: number | undefined;
5629
+ numPublishers?: number | undefined;
5620
5630
  activeRecording?: boolean | undefined;
5621
5631
  } & {
5622
5632
  [K_77 in Exclude<keyof I["message"]["roomUpdate"]["room"], keyof Room>]: never;
@@ -6053,6 +6063,7 @@ export declare const SignalResponse: {
6053
6063
  }[] | undefined;
6054
6064
  metadata?: string | undefined;
6055
6065
  numParticipants?: number | undefined;
6066
+ numPublishers?: number | undefined;
6056
6067
  activeRecording?: boolean | undefined;
6057
6068
  } | undefined;
6058
6069
  participant?: {
@@ -6364,6 +6375,7 @@ export declare const SignalResponse: {
6364
6375
  }[] | undefined;
6365
6376
  metadata?: string | undefined;
6366
6377
  numParticipants?: number | undefined;
6378
+ numPublishers?: number | undefined;
6367
6379
  activeRecording?: boolean | undefined;
6368
6380
  } | undefined;
6369
6381
  } | undefined;
@@ -6478,6 +6490,7 @@ export declare const SignalResponse: {
6478
6490
  }[] | undefined;
6479
6491
  metadata?: string | undefined;
6480
6492
  numParticipants?: number | undefined;
6493
+ numPublishers?: number | undefined;
6481
6494
  activeRecording?: boolean | undefined;
6482
6495
  } | undefined;
6483
6496
  participant?: {
@@ -6643,6 +6656,7 @@ export declare const SignalResponse: {
6643
6656
  }[] | undefined;
6644
6657
  metadata?: string | undefined;
6645
6658
  numParticipants?: number | undefined;
6659
+ numPublishers?: number | undefined;
6646
6660
  activeRecording?: boolean | undefined;
6647
6661
  } | undefined;
6648
6662
  participant?: {
@@ -6804,6 +6818,7 @@ export declare const SignalResponse: {
6804
6818
  }[] | undefined;
6805
6819
  metadata?: string | undefined;
6806
6820
  numParticipants?: number | undefined;
6821
+ numPublishers?: number | undefined;
6807
6822
  activeRecording?: boolean | undefined;
6808
6823
  } & {
6809
6824
  sid?: string | undefined;
@@ -6831,6 +6846,7 @@ export declare const SignalResponse: {
6831
6846
  }) | undefined;
6832
6847
  metadata?: string | undefined;
6833
6848
  numParticipants?: number | undefined;
6849
+ numPublishers?: number | undefined;
6834
6850
  activeRecording?: boolean | undefined;
6835
6851
  } & {
6836
6852
  [K_118 in Exclude<keyof I_1["message"]["join"]["room"], keyof Room>]: never;
@@ -8621,6 +8637,7 @@ export declare const SignalResponse: {
8621
8637
  }[] | undefined;
8622
8638
  metadata?: string | undefined;
8623
8639
  numParticipants?: number | undefined;
8640
+ numPublishers?: number | undefined;
8624
8641
  activeRecording?: boolean | undefined;
8625
8642
  } | undefined;
8626
8643
  } | undefined;
@@ -8641,6 +8658,7 @@ export declare const SignalResponse: {
8641
8658
  }[] | undefined;
8642
8659
  metadata?: string | undefined;
8643
8660
  numParticipants?: number | undefined;
8661
+ numPublishers?: number | undefined;
8644
8662
  activeRecording?: boolean | undefined;
8645
8663
  } | undefined;
8646
8664
  } & {
@@ -8657,6 +8675,7 @@ export declare const SignalResponse: {
8657
8675
  }[] | undefined;
8658
8676
  metadata?: string | undefined;
8659
8677
  numParticipants?: number | undefined;
8678
+ numPublishers?: number | undefined;
8660
8679
  activeRecording?: boolean | undefined;
8661
8680
  } & {
8662
8681
  sid?: string | undefined;
@@ -8684,6 +8703,7 @@ export declare const SignalResponse: {
8684
8703
  }) | undefined;
8685
8704
  metadata?: string | undefined;
8686
8705
  numParticipants?: number | undefined;
8706
+ numPublishers?: number | undefined;
8687
8707
  activeRecording?: boolean | undefined;
8688
8708
  } & {
8689
8709
  [K_193 in Exclude<keyof I_1["message"]["roomUpdate"]["room"], keyof Room>]: never;
@@ -9388,6 +9408,7 @@ export declare const JoinResponse: {
9388
9408
  }[] | undefined;
9389
9409
  metadata?: string | undefined;
9390
9410
  numParticipants?: number | undefined;
9411
+ numPublishers?: number | undefined;
9391
9412
  activeRecording?: boolean | undefined;
9392
9413
  } | undefined;
9393
9414
  participant?: {
@@ -9549,6 +9570,7 @@ export declare const JoinResponse: {
9549
9570
  }[] | undefined;
9550
9571
  metadata?: string | undefined;
9551
9572
  numParticipants?: number | undefined;
9573
+ numPublishers?: number | undefined;
9552
9574
  activeRecording?: boolean | undefined;
9553
9575
  } & {
9554
9576
  sid?: string | undefined;
@@ -9576,6 +9598,7 @@ export declare const JoinResponse: {
9576
9598
  }) | undefined;
9577
9599
  metadata?: string | undefined;
9578
9600
  numParticipants?: number | undefined;
9601
+ numPublishers?: number | undefined;
9579
9602
  activeRecording?: boolean | undefined;
9580
9603
  } & {
9581
9604
  [K_2 in Exclude<keyof I["room"], keyof Room>]: never;
@@ -10434,6 +10457,7 @@ export declare const JoinResponse: {
10434
10457
  }[] | undefined;
10435
10458
  metadata?: string | undefined;
10436
10459
  numParticipants?: number | undefined;
10460
+ numPublishers?: number | undefined;
10437
10461
  activeRecording?: boolean | undefined;
10438
10462
  } | undefined;
10439
10463
  participant?: {
@@ -10595,6 +10619,7 @@ export declare const JoinResponse: {
10595
10619
  }[] | undefined;
10596
10620
  metadata?: string | undefined;
10597
10621
  numParticipants?: number | undefined;
10622
+ numPublishers?: number | undefined;
10598
10623
  activeRecording?: boolean | undefined;
10599
10624
  } & {
10600
10625
  sid?: string | undefined;
@@ -10622,6 +10647,7 @@ export declare const JoinResponse: {
10622
10647
  }) | undefined;
10623
10648
  metadata?: string | undefined;
10624
10649
  numParticipants?: number | undefined;
10650
+ numPublishers?: number | undefined;
10625
10651
  activeRecording?: boolean | undefined;
10626
10652
  } & {
10627
10653
  [K_39 in Exclude<keyof I_1["room"], keyof Room>]: never;
@@ -13478,6 +13504,7 @@ export declare const RoomUpdate: {
13478
13504
  }[] | undefined;
13479
13505
  metadata?: string | undefined;
13480
13506
  numParticipants?: number | undefined;
13507
+ numPublishers?: number | undefined;
13481
13508
  activeRecording?: boolean | undefined;
13482
13509
  } | undefined;
13483
13510
  } & {
@@ -13494,6 +13521,7 @@ export declare const RoomUpdate: {
13494
13521
  }[] | undefined;
13495
13522
  metadata?: string | undefined;
13496
13523
  numParticipants?: number | undefined;
13524
+ numPublishers?: number | undefined;
13497
13525
  activeRecording?: boolean | undefined;
13498
13526
  } & {
13499
13527
  sid?: string | undefined;
@@ -13521,6 +13549,7 @@ export declare const RoomUpdate: {
13521
13549
  }) | undefined;
13522
13550
  metadata?: string | undefined;
13523
13551
  numParticipants?: number | undefined;
13552
+ numPublishers?: number | undefined;
13524
13553
  activeRecording?: boolean | undefined;
13525
13554
  } & {
13526
13555
  [K_2 in Exclude<keyof I["room"], keyof Room>]: never;
@@ -13542,6 +13571,7 @@ export declare const RoomUpdate: {
13542
13571
  }[] | undefined;
13543
13572
  metadata?: string | undefined;
13544
13573
  numParticipants?: number | undefined;
13574
+ numPublishers?: number | undefined;
13545
13575
  activeRecording?: boolean | undefined;
13546
13576
  } | undefined;
13547
13577
  } & {
@@ -13558,6 +13588,7 @@ export declare const RoomUpdate: {
13558
13588
  }[] | undefined;
13559
13589
  metadata?: string | undefined;
13560
13590
  numParticipants?: number | undefined;
13591
+ numPublishers?: number | undefined;
13561
13592
  activeRecording?: boolean | undefined;
13562
13593
  } & {
13563
13594
  sid?: string | undefined;
@@ -13585,6 +13616,7 @@ export declare const RoomUpdate: {
13585
13616
  }) | undefined;
13586
13617
  metadata?: string | undefined;
13587
13618
  numParticipants?: number | undefined;
13619
+ numPublishers?: number | undefined;
13588
13620
  activeRecording?: boolean | undefined;
13589
13621
  } & {
13590
13622
  [K_6 in Exclude<keyof I_1["room"], keyof Room>]: never;
@@ -17,6 +17,7 @@ export default class RTCEngine extends RTCEngine_base {
17
17
  client: SignalClient;
18
18
  rtcConfig: RTCConfiguration;
19
19
  peerConnectionTimeout: number;
20
+ fullReconnectOnNext: boolean;
20
21
  get isClosed(): boolean;
21
22
  private lossyDC?;
22
23
  private lossyDCSub?;
@@ -34,7 +35,6 @@ export default class RTCEngine extends RTCEngine_base {
34
35
  private signalOpts?;
35
36
  private reconnectAttempts;
36
37
  private reconnectStart;
37
- private fullReconnectOnNext;
38
38
  private clientConfiguration?;
39
39
  private attemptingReconnect;
40
40
  private reconnectPolicy;
@@ -81,7 +81,8 @@ export default class RTCEngine extends RTCEngine_base {
81
81
  private restartConnection;
82
82
  private resumeConnection;
83
83
  waitForPCInitialConnection(timeout?: number, abortController?: AbortController): Promise<void>;
84
- waitForPCReconnected(): Promise<void>;
84
+ private waitForPCReconnected;
85
+ waitForRestarted: () => Promise<void>;
85
86
  sendDataPacket(packet: DataPacket, kind: DataPacket_Kind): Promise<void>;
86
87
  private updateAndEmitDCBufferStatus;
87
88
  private isBufferStatusLow;
@@ -106,8 +107,9 @@ export type EngineEventCallbacks = {
106
107
  resuming: () => void;
107
108
  resumed: () => void;
108
109
  restarting: () => void;
109
- restarted: (joinResp: JoinResponse) => void;
110
+ restarted: () => void;
110
111
  signalResumed: () => void;
112
+ signalRestarted: (joinResp: JoinResponse) => void;
111
113
  closing: () => void;
112
114
  mediaTrackAdded: (track: MediaStreamTrack, streams: MediaStream, receiver?: RTCRtpReceiver) => void;
113
115
  activeSpeakersUpdate: (speakers: Array<SpeakerInfo>) => void;
@@ -1,17 +1,17 @@
1
1
  import type TypedEmitter from 'typed-emitter';
2
2
  import type { InternalRoomOptions, RoomConnectOptions, RoomOptions } from '../options';
3
3
  import { DataPacket_Kind, DisconnectReason, ParticipantPermission } from '../proto/livekit_models';
4
+ import RTCEngine from './RTCEngine';
4
5
  import LocalParticipant from './participant/LocalParticipant';
5
6
  import type Participant from './participant/Participant';
6
7
  import type { ConnectionQuality } from './participant/Participant';
7
8
  import RemoteParticipant from './participant/RemoteParticipant';
8
- import RTCEngine from './RTCEngine';
9
9
  import LocalTrackPublication from './track/LocalTrackPublication';
10
10
  import type RemoteTrack from './track/RemoteTrack';
11
11
  import RemoteTrackPublication from './track/RemoteTrackPublication';
12
12
  import { Track } from './track/Track';
13
13
  import type { TrackPublication } from './track/TrackPublication';
14
- import type { SimulationOptions } from './types';
14
+ import type { SimulationOptions, SimulationScenario } from './types';
15
15
  export declare enum ConnectionState {
16
16
  Disconnected = "disconnected",
17
17
  Connecting = "connecting",
@@ -40,17 +40,11 @@ declare class Room extends Room_base {
40
40
  activeSpeakers: Participant[];
41
41
  /** @internal */
42
42
  engine: RTCEngine;
43
- /** server assigned unique room id */
44
- sid: string;
45
- /** user assigned name, derived from JWT token */
46
- name: string;
47
43
  /** the current participant */
48
44
  localParticipant: LocalParticipant;
49
- /** room metadata */
50
- metadata: string | undefined;
51
45
  /** options of room */
52
46
  options: InternalRoomOptions;
53
- private _isRecording;
47
+ private roomInfo?;
54
48
  private identityToSid;
55
49
  /** connect options of room */
56
50
  private connOptions?;
@@ -66,6 +60,18 @@ declare class Room extends Room_base {
66
60
  * @param options
67
61
  */
68
62
  constructor(options?: RoomOptions);
63
+ /**
64
+ * if the current room has a participant with `recorder: true` in its JWT grant
65
+ **/
66
+ get isRecording(): boolean;
67
+ /** server assigned unique room id */
68
+ get sid(): string;
69
+ /** user assigned name, derived from JWT token */
70
+ get name(): string;
71
+ /** room metadata */
72
+ get metadata(): string | undefined;
73
+ get numParticipants(): number;
74
+ get numPublishers(): number;
69
75
  private maybeCreateEngine;
70
76
  /**
71
77
  * getLocalDevices abstracts navigator.mediaDevices.enumerateDevices.
@@ -100,14 +106,10 @@ declare class Room extends Room_base {
100
106
  */
101
107
  getParticipantByIdentity(identity: string): Participant | undefined;
102
108
  private clearConnectionFutures;
103
- /**
104
- * if the current room has a participant with `recorder: true` in its JWT grant
105
- **/
106
- get isRecording(): boolean;
107
109
  /**
108
110
  * @internal for testing
109
111
  */
110
- simulateScenario(scenario: string): Promise<void>;
112
+ simulateScenario(scenario: SimulationScenario): Promise<void>;
111
113
  private onPageLeave;
112
114
  /**
113
115
  * Browsers have different policies regarding audio playback. Most requiring
@@ -144,7 +146,7 @@ declare class Room extends Room_base {
144
146
  private recreateEngine;
145
147
  private onTrackAdded;
146
148
  private handleRestarting;
147
- private handleRestarted;
149
+ private handleSignalRestarted;
148
150
  private handleDisconnect;
149
151
  private handleParticipantUpdates;
150
152
  private handleParticipantDisconnected;
@@ -170,6 +172,7 @@ declare class Room extends Room_base {
170
172
  private setAndEmitConnectionState;
171
173
  private emitWhenConnected;
172
174
  private onLocalParticipantMetadataChanged;
175
+ private onLocalParticipantNameChanged;
173
176
  private onLocalTrackMuted;
174
177
  private onLocalTrackUnmuted;
175
178
  private onLocalTrackPublished;
@@ -208,6 +211,7 @@ export type RoomEventCallbacks = {
208
211
  localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
209
212
  localAudioSilenceDetected: (publication: LocalTrackPublication) => void;
210
213
  participantMetadataChanged: (metadata: string | undefined, participant: RemoteParticipant | LocalParticipant) => void;
214
+ participantNameChanged: (name: string, participant: RemoteParticipant | LocalParticipant) => void;
211
215
  participantPermissionsChanged: (prevPermissions: ParticipantPermission | undefined, participant: RemoteParticipant | LocalParticipant) => void;
212
216
  activeSpeakersChanged: (speakers: Array<Participant>) => void;
213
217
  roomMetadataChanged: (metadata: string) => void;
@@ -146,6 +146,13 @@ export declare enum RoomEvent {
146
146
  *
147
147
  */
148
148
  ParticipantMetadataChanged = "participantMetadataChanged",
149
+ /**
150
+ * Participant's display name changed
151
+ *
152
+ * args: (name: string, [[Participant]])
153
+ *
154
+ */
155
+ ParticipantNameChanged = "participantNameChanged",
149
156
  /**
150
157
  * Room metadata is a simple way for app-specific state to be pushed to
151
158
  * all users.
@@ -315,6 +322,13 @@ export declare enum ParticipantEvent {
315
322
  *
316
323
  */
317
324
  ParticipantMetadataChanged = "participantMetadataChanged",
325
+ /**
326
+ * Participant's display name changed
327
+ *
328
+ * args: (name: string, [[Participant]])
329
+ *
330
+ */
331
+ ParticipantNameChanged = "participantNameChanged",
318
332
  /**
319
333
  * Data received from this participant as sender.
320
334
  * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
@@ -380,6 +394,7 @@ export declare enum EngineEvent {
380
394
  Restarting = "restarting",
381
395
  Restarted = "restarted",
382
396
  SignalResumed = "signalResumed",
397
+ SignalRestarted = "signalRestarted",
383
398
  Closing = "closing",
384
399
  MediaTrackAdded = "mediaTrackAdded",
385
400
  ActiveSpeakersUpdate = "activeSpeakersUpdate",
@@ -5,8 +5,8 @@ import { DataChannelInfo, TrackPublishedResponse } from '../../proto/livekit_rtc
5
5
  import type RTCEngine from '../RTCEngine';
6
6
  import LocalTrack from '../track/LocalTrack';
7
7
  import LocalTrackPublication from '../track/LocalTrackPublication';
8
- import { AudioCaptureOptions, BackupVideoCodec, CreateLocalTracksOptions, ScreenShareCaptureOptions, TrackPublishOptions, VideoCaptureOptions } from '../track/options';
9
8
  import { Track } from '../track/Track';
9
+ import { AudioCaptureOptions, BackupVideoCodec, CreateLocalTracksOptions, ScreenShareCaptureOptions, TrackPublishOptions, VideoCaptureOptions } from '../track/options';
10
10
  import type { DataPublishOptions } from '../types';
11
11
  import Participant from './Participant';
12
12
  import { ParticipantTrackPermission } from './ParticipantTrackPermission';
@@ -39,6 +39,18 @@ export default class LocalParticipant extends Participant {
39
39
  private handleReconnecting;
40
40
  private handleReconnected;
41
41
  private handleDisconnected;
42
+ /**
43
+ * Sets and updates the metadata of the local participant.
44
+ * Note: this requires `CanUpdateOwnMetadata` permission encoded in the token.
45
+ * @param metadata
46
+ */
47
+ setMetadata(metadata: string): void;
48
+ /**
49
+ * Sets and updates the name of the local participant.
50
+ * Note: this requires `CanUpdateOwnMetadata` permission encoded in the token.
51
+ * @param metadata
52
+ */
53
+ setName(name: string): void;
42
54
  /**
43
55
  * Enable or disable a participant's camera track.
44
56
  *
@@ -139,7 +151,7 @@ export default class LocalParticipant extends Participant {
139
151
  */
140
152
  setTrackSubscriptionPermissions(allParticipantsAllowed: boolean, participantTrackPermissions?: ParticipantTrackPermission[]): void;
141
153
  /** @internal */
142
- updateInfo(info: ParticipantInfo): void;
154
+ updateInfo(info: ParticipantInfo): boolean;
143
155
  private updateTrackSubscriptionPermissions;
144
156
  /** @internal */
145
157
  private onTrackUnmuted;
@@ -1,5 +1,5 @@
1
1
  import type TypedEmitter from 'typed-emitter';
2
- import { ConnectionQuality as ProtoQuality, DataPacket_Kind, ParticipantInfo, ParticipantPermission } from '../../proto/livekit_models';
2
+ import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, ConnectionQuality as ProtoQuality } from '../../proto/livekit_models';
3
3
  import type LocalTrackPublication from '../track/LocalTrackPublication';
4
4
  import type RemoteTrack from '../track/RemoteTrack';
5
5
  import type RemoteTrackPublication from '../track/RemoteTrackPublication';
@@ -57,9 +57,10 @@ export default class Participant extends Participant_base {
57
57
  /** when participant joined the room */
58
58
  get joinedAt(): Date | undefined;
59
59
  /** @internal */
60
- updateInfo(info: ParticipantInfo): void;
60
+ updateInfo(info: ParticipantInfo): boolean;
61
61
  /** @internal */
62
62
  setMetadata(md: string): void;
63
+ protected setName(name: string): void;
63
64
  /** @internal */
64
65
  setPermissions(permissions: ParticipantPermission): boolean;
65
66
  /** @internal */
@@ -79,6 +80,7 @@ export type ParticipantEventCallbacks = {
79
80
  localTrackPublished: (publication: LocalTrackPublication) => void;
80
81
  localTrackUnpublished: (publication: LocalTrackPublication) => void;
81
82
  participantMetadataChanged: (prevMetadata: string | undefined, participant?: any) => void;
83
+ participantNameChanged: (name: string) => void;
82
84
  dataReceived: (payload: Uint8Array, kind: DataPacket_Kind) => void;
83
85
  isSpeakingChanged: (speaking: boolean) => void;
84
86
  connectionQualityChanged: (connectionQuality: ConnectionQuality) => void;
@@ -1,8 +1,8 @@
1
1
  import type { SignalClient } from '../../api/SignalClient';
2
2
  import type { ParticipantInfo } from '../../proto/livekit_models';
3
- import type { AudioOutputOptions } from '../track/options';
4
3
  import RemoteTrackPublication from '../track/RemoteTrackPublication';
5
4
  import { Track } from '../track/Track';
5
+ import type { AudioOutputOptions } from '../track/options';
6
6
  import type { AdaptiveStreamSettings } from '../track/types';
7
7
  import Participant, { ParticipantEventCallbacks } from './Participant';
8
8
  export default class RemoteParticipant extends Participant {
@@ -35,7 +35,7 @@ export default class RemoteParticipant extends Participant {
35
35
  get hasMetadata(): boolean;
36
36
  getTrackPublication(sid: Track.SID): RemoteTrackPublication | undefined;
37
37
  /** @internal */
38
- updateInfo(info: ParticipantInfo): void;
38
+ updateInfo(info: ParticipantInfo): boolean;
39
39
  /** @internal */
40
40
  unpublishTrack(sid: Track.SID, sendUnpublish?: boolean): void;
41
41
  /**
@@ -1,6 +1,6 @@
1
1
  import { Mutex } from '../utils';
2
- import type { VideoCodec } from './options';
3
2
  import { Track } from './Track';
3
+ import type { VideoCodec } from './options';
4
4
  export default abstract class LocalTrack extends Track {
5
5
  /** @internal */
6
6
  sender?: RTCRtpSender;