livekit-client 1.12.0 → 1.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/README.md +19 -1
  2. package/dist/livekit-client.e2ee.worker.js +1 -1
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  4. package/dist/livekit-client.e2ee.worker.mjs +442 -334
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +12303 -14499
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.umd.js +1 -1
  9. package/dist/livekit-client.umd.js.map +1 -1
  10. package/dist/src/api/SignalClient.d.ts +2 -2
  11. package/dist/src/api/SignalClient.d.ts.map +1 -1
  12. package/dist/src/connectionHelper/ConnectionCheck.d.ts +3 -2
  13. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  14. package/dist/src/connectionHelper/checks/Checker.d.ts +3 -2
  15. package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
  16. package/dist/src/connectionHelper/checks/webrtc.d.ts.map +1 -1
  17. package/dist/src/connectionHelper/checks/websocket.d.ts.map +1 -1
  18. package/dist/src/e2ee/E2eeManager.d.ts +4 -2
  19. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  20. package/dist/src/e2ee/KeyProvider.d.ts +4 -2
  21. package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
  22. package/dist/src/e2ee/constants.d.ts +1 -0
  23. package/dist/src/e2ee/constants.d.ts.map +1 -1
  24. package/dist/src/e2ee/types.d.ts +1 -0
  25. package/dist/src/e2ee/types.d.ts.map +1 -1
  26. package/dist/src/e2ee/worker/FrameCryptor.d.ts +4 -3
  27. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  28. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +21 -2
  29. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/dist/src/proto/livekit_models_pb.d.ts +1264 -0
  33. package/dist/src/proto/livekit_models_pb.d.ts.map +1 -0
  34. package/dist/src/proto/livekit_rtc_pb.d.ts +1373 -0
  35. package/dist/src/proto/livekit_rtc_pb.d.ts.map +1 -0
  36. package/dist/src/room/PCTransport.d.ts +2 -1
  37. package/dist/src/room/PCTransport.d.ts.map +1 -1
  38. package/dist/src/room/RTCEngine.d.ts +9 -5
  39. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  40. package/dist/src/room/RegionUrlProvider.d.ts +4 -1
  41. package/dist/src/room/RegionUrlProvider.d.ts.map +1 -1
  42. package/dist/src/room/Room.d.ts +15 -11
  43. package/dist/src/room/Room.d.ts.map +1 -1
  44. package/dist/src/room/participant/LocalParticipant.d.ts +2 -2
  45. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  46. package/dist/src/room/participant/Participant.d.ts +5 -3
  47. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  48. package/dist/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
  49. package/dist/src/room/participant/ParticipantTrackPermission.d.ts.map +1 -1
  50. package/dist/src/room/participant/RemoteParticipant.d.ts +8 -7
  51. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  52. package/dist/src/room/timers.d.ts +5 -4
  53. package/dist/src/room/timers.d.ts.map +1 -1
  54. package/dist/src/room/track/LocalTrack.d.ts +3 -0
  55. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  56. package/dist/src/room/track/LocalTrackPublication.d.ts +1 -1
  57. package/dist/src/room/track/LocalTrackPublication.d.ts.map +1 -1
  58. package/dist/src/room/track/LocalVideoTrack.d.ts +2 -2
  59. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  60. package/dist/src/room/track/RemoteTrackPublication.d.ts +1 -1
  61. package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
  62. package/dist/src/room/track/Track.d.ts +6 -4
  63. package/dist/src/room/track/Track.d.ts.map +1 -1
  64. package/dist/src/room/track/TrackPublication.d.ts +7 -5
  65. package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
  66. package/dist/src/room/track/create.d.ts.map +1 -1
  67. package/dist/src/room/track/options.d.ts +7 -0
  68. package/dist/src/room/track/options.d.ts.map +1 -1
  69. package/dist/src/room/track/utils.d.ts +5 -1
  70. package/dist/src/room/track/utils.d.ts.map +1 -1
  71. package/dist/src/room/utils.d.ts +3 -1
  72. package/dist/src/room/utils.d.ts.map +1 -1
  73. package/dist/src/test/mocks.d.ts +4 -3
  74. package/dist/src/test/mocks.d.ts.map +1 -1
  75. package/dist/src/utils/browserParser.d.ts +2 -0
  76. package/dist/src/utils/browserParser.d.ts.map +1 -1
  77. package/dist/ts4.2/src/api/SignalClient.d.ts +2 -2
  78. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +3 -2
  79. package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +3 -2
  80. package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +4 -2
  81. package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +4 -2
  82. package/dist/ts4.2/src/e2ee/constants.d.ts +1 -0
  83. package/dist/ts4.2/src/e2ee/types.d.ts +1 -0
  84. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +4 -3
  85. package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +21 -2
  86. package/dist/ts4.2/src/index.d.ts +1 -1
  87. package/dist/ts4.2/src/proto/livekit_models_pb.d.ts +1264 -0
  88. package/dist/ts4.2/src/proto/livekit_rtc_pb.d.ts +1373 -0
  89. package/dist/ts4.2/src/room/PCTransport.d.ts +2 -1
  90. package/dist/ts4.2/src/room/RTCEngine.d.ts +9 -5
  91. package/dist/ts4.2/src/room/RegionUrlProvider.d.ts +4 -1
  92. package/dist/ts4.2/src/room/Room.d.ts +15 -11
  93. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +2 -2
  94. package/dist/ts4.2/src/room/participant/Participant.d.ts +5 -3
  95. package/dist/ts4.2/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
  96. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +8 -7
  97. package/dist/ts4.2/src/room/timers.d.ts +5 -4
  98. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +3 -0
  99. package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +1 -1
  100. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +2 -2
  101. package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +1 -1
  102. package/dist/ts4.2/src/room/track/Track.d.ts +6 -4
  103. package/dist/ts4.2/src/room/track/TrackPublication.d.ts +7 -5
  104. package/dist/ts4.2/src/room/track/options.d.ts +7 -0
  105. package/dist/ts4.2/src/room/track/utils.d.ts +5 -1
  106. package/dist/ts4.2/src/room/utils.d.ts +3 -1
  107. package/dist/ts4.2/src/test/mocks.d.ts +4 -3
  108. package/dist/ts4.2/src/utils/browserParser.d.ts +2 -0
  109. package/package.json +10 -10
  110. package/src/api/SignalClient.ts +104 -101
  111. package/src/connectionHelper/ConnectionCheck.ts +3 -2
  112. package/src/connectionHelper/checks/Checker.ts +3 -3
  113. package/src/connectionHelper/checks/webrtc.ts +66 -2
  114. package/src/connectionHelper/checks/websocket.ts +4 -0
  115. package/src/e2ee/E2eeManager.ts +4 -3
  116. package/src/e2ee/KeyProvider.ts +3 -2
  117. package/src/e2ee/constants.ts +4 -0
  118. package/src/e2ee/types.ts +1 -0
  119. package/src/e2ee/worker/FrameCryptor.test.ts +1 -3
  120. package/src/e2ee/worker/FrameCryptor.ts +14 -16
  121. package/src/e2ee/worker/ParticipantKeyHandler.ts +48 -2
  122. package/src/e2ee/worker/e2ee.worker.ts +12 -6
  123. package/src/index.ts +1 -1
  124. package/src/proto/livekit_models_pb.ts +2096 -0
  125. package/src/proto/livekit_rtc_pb.ts +2332 -0
  126. package/src/room/PCTransport.ts +1 -1
  127. package/src/room/RTCEngine.ts +24 -18
  128. package/src/room/RegionUrlProvider.ts +11 -2
  129. package/src/room/Room.test.ts +1 -0
  130. package/src/room/Room.ts +175 -86
  131. package/src/room/participant/LocalParticipant.ts +43 -59
  132. package/src/room/participant/Participant.ts +6 -4
  133. package/src/room/participant/ParticipantTrackPermission.ts +3 -3
  134. package/src/room/participant/RemoteParticipant.ts +24 -21
  135. package/src/room/participant/publishUtils.test.ts +1 -0
  136. package/src/room/track/LocalTrack.ts +24 -9
  137. package/src/room/track/LocalTrackPublication.ts +1 -1
  138. package/src/room/track/LocalVideoTrack.test.ts +2 -1
  139. package/src/room/track/LocalVideoTrack.ts +22 -22
  140. package/src/room/track/RemoteTrackPublication.ts +12 -7
  141. package/src/room/track/RemoteVideoTrack.test.ts +5 -4
  142. package/src/room/track/Track.ts +9 -6
  143. package/src/room/track/TrackPublication.ts +7 -5
  144. package/src/room/track/create.ts +18 -17
  145. package/src/room/track/facingMode.test.ts +1 -0
  146. package/src/room/track/options.ts +6 -0
  147. package/src/room/track/utils.test.ts +1 -0
  148. package/src/room/track/utils.ts +44 -2
  149. package/src/room/utils.test.ts +16 -0
  150. package/src/room/utils.ts +20 -4
  151. package/src/test/mocks.ts +7 -5
  152. package/src/utils/AsyncQueue.test.ts +1 -0
  153. package/src/utils/browserParser.test.ts +33 -3
  154. package/src/utils/browserParser.ts +5 -0
  155. package/dist/src/proto/google/protobuf/timestamp.d.ts +0 -146
  156. package/dist/src/proto/google/protobuf/timestamp.d.ts.map +0 -1
  157. package/dist/src/proto/livekit_models.d.ts +0 -2399
  158. package/dist/src/proto/livekit_models.d.ts.map +0 -1
  159. package/dist/src/proto/livekit_rtc.d.ts +0 -14352
  160. package/dist/src/proto/livekit_rtc.d.ts.map +0 -1
  161. package/dist/ts4.2/src/proto/google/protobuf/timestamp.d.ts +0 -150
  162. package/dist/ts4.2/src/proto/livekit_models.d.ts +0 -2659
  163. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +0 -15764
  164. package/src/proto/google/protobuf/timestamp.ts +0 -230
  165. package/src/proto/livekit_models.ts +0 -4006
  166. package/src/proto/livekit_rtc.ts +0 -4672
@@ -1,4 +1,5 @@
1
- import EventEmitter from 'eventemitter3';
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
2
3
  /** @internal */
3
4
  interface TrackBitrateInfo {
4
5
  cid?: string;
@@ -1,17 +1,19 @@
1
- import EventEmitter from 'eventemitter3';
2
- import { SignalClient } from '../api/SignalClient';
1
+ import type TypedEventEmitter from 'typed-emitter';
3
2
  import type { SignalOptions } from '../api/SignalClient';
3
+ import { SignalClient } from '../api/SignalClient';
4
4
  import type { InternalRoomOptions } from '../options';
5
- import { DataPacket, DataPacket_Kind, DisconnectReason, ParticipantInfo, Room as RoomModel, SpeakerInfo, TrackInfo, UserPacket } from '../proto/livekit_models';
6
- import { AddTrackRequest, ConnectionQualityUpdate, JoinResponse, StreamStateUpdate, SubscriptionPermissionUpdate, SubscriptionResponse } from '../proto/livekit_rtc';
5
+ import { DataPacket, DataPacket_Kind, DisconnectReason, ParticipantInfo, Room as RoomModel, SpeakerInfo, TrackInfo, UserPacket } from '../proto/livekit_models_pb';
6
+ import { AddTrackRequest, ConnectionQualityUpdate, JoinResponse, StreamStateUpdate, SubscriptionPermissionUpdate, SubscriptionResponse } from '../proto/livekit_rtc_pb';
7
7
  import PCTransport from './PCTransport';
8
+ import type { RegionUrlProvider } from './RegionUrlProvider';
8
9
  import type LocalTrack from './track/LocalTrack';
9
10
  import type LocalVideoTrack from './track/LocalVideoTrack';
10
11
  import type { SimulcastTrackInfo } from './track/LocalVideoTrack';
11
12
  import { Track } from './track/Track';
12
13
  import type { TrackPublishOptions, VideoCodec } from './track/options';
14
+ declare const RTCEngine_base: new () => TypedEventEmitter<EngineEventCallbacks>;
13
15
  /** @internal */
14
- export default class RTCEngine extends EventEmitter<EngineEventCallbacks> {
16
+ export default class RTCEngine extends RTCEngine_base {
15
17
  private options;
16
18
  publisher?: PCTransport;
17
19
  subscriber?: PCTransport;
@@ -69,6 +71,7 @@ export default class RTCEngine extends EventEmitter<EngineEventCallbacks> {
69
71
  updateMuteStatus(trackSid: string, muted: boolean): void;
70
72
  get dataSubscriberReadyState(): string | undefined;
71
73
  getConnectedServerAddress(): Promise<string | undefined>;
74
+ setRegionUrlProvider(provider: RegionUrlProvider): void;
72
75
  private configure;
73
76
  private setupSignalClientCallbacks;
74
77
  private makeRTCConfiguration;
@@ -136,4 +139,5 @@ export type EngineEventCallbacks = {
136
139
  subscriptionError: (resp: SubscriptionResponse) => void;
137
140
  subscriptionPermissionUpdate: (update: SubscriptionPermissionUpdate) => void;
138
141
  };
142
+ export {};
139
143
  //# sourceMappingURL=RTCEngine.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { RegionSettings } from '../proto/livekit_rtc_pb';
1
2
  export declare class RegionUrlProvider {
2
3
  private serverUrl;
3
4
  private token;
@@ -6,9 +7,11 @@ export declare class RegionUrlProvider {
6
7
  private settingsCacheTime;
7
8
  private attemptedRegions;
8
9
  constructor(url: string, token: string);
10
+ updateToken(token: string): void;
9
11
  isCloud(): boolean;
12
+ getServerUrl(): URL;
10
13
  getNextBestRegionUrl(abortSignal?: AbortSignal): Promise<string | null>;
11
14
  resetAttempts(): void;
12
- private fetchRegionSettings;
15
+ fetchRegionSettings(signal?: AbortSignal): Promise<RegionSettings>;
13
16
  }
14
17
  //# sourceMappingURL=RegionUrlProvider.d.ts.map
@@ -1,7 +1,7 @@
1
- import EventEmitter from 'eventemitter3';
1
+ import type TypedEmitter from 'typed-emitter';
2
2
  import 'webrtc-adapter';
3
3
  import type { InternalRoomOptions, RoomConnectOptions, RoomOptions } from '../options';
4
- import { DataPacket_Kind, DisconnectReason, ParticipantPermission, SubscriptionError } from '../proto/livekit_models';
4
+ import { DataPacket_Kind, DisconnectReason, ParticipantPermission, SubscriptionError } from '../proto/livekit_models_pb';
5
5
  import RTCEngine from './RTCEngine';
6
6
  import LocalParticipant from './participant/LocalParticipant';
7
7
  import type Participant from './participant/Participant';
@@ -21,6 +21,7 @@ export declare enum ConnectionState {
21
21
  }
22
22
  /** @deprecated RoomState has been renamed to [[ConnectionState]] */
23
23
  export declare const RoomState: typeof ConnectionState;
24
+ declare const Room_base: new () => TypedEmitter<RoomEventCallbacks>;
24
25
  /**
25
26
  * In LiveKit, a room is the logical grouping for a list of participants.
26
27
  * Participants in a room can publish tracks, and subscribe to others' tracks.
@@ -29,7 +30,7 @@ export declare const RoomState: typeof ConnectionState;
29
30
  *
30
31
  * @noInheritDoc
31
32
  */
32
- declare class Room extends EventEmitter<RoomEventCallbacks> {
33
+ declare class Room extends Room_base {
33
34
  state: ConnectionState;
34
35
  /** map of sid: [[RemoteParticipant]] */
35
36
  participants: Map<string, RemoteParticipant>;
@@ -60,6 +61,8 @@ declare class Room extends EventEmitter<RoomEventCallbacks> {
60
61
  private e2eeManager;
61
62
  private cachedParticipantSids;
62
63
  private connectionReconcileInterval?;
64
+ private regionUrlProvider?;
65
+ private regionUrl?;
63
66
  /**
64
67
  * Creates a new Room, the primary construct for a LiveKit session.
65
68
  * @param options
@@ -93,14 +96,15 @@ declare class Room extends EventEmitter<RoomEventCallbacks> {
93
96
  */
94
97
  static getLocalDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
95
98
  /**
96
- * prepares the connection to the livekit server by sending a HEAD request in order to
97
- * 1. speed up DNS resolution
98
- * 2. speed up TLS setup
99
- * on the actual connection request
100
- * throws an error if server is not reachable after the request timeout
101
- * @experimental
99
+ * prepareConnection should be called as soon as the page is loaded, in order
100
+ * to speed up the connection attempt. This function will
101
+ * - perform DNS resolution and pre-warm the DNS cache
102
+ * - establish TLS connection and cache TLS keys
103
+ *
104
+ * With LiveKit Cloud, it will also determine the best edge data center for
105
+ * the current client to connect to if a token is provided.
102
106
  */
103
- prepareConnection(url: string): Promise<void>;
107
+ prepareConnection(url: string, token?: string): Promise<void>;
104
108
  connect: (url: string, token: string, opts?: RoomConnectOptions) => Promise<void>;
105
109
  private connectSignal;
106
110
  private applyJoinResponse;
@@ -198,7 +202,7 @@ declare class Room extends EventEmitter<RoomEventCallbacks> {
198
202
  * @experimental
199
203
  */
200
204
  simulateParticipants(options: SimulationOptions): Promise<void>;
201
- emit<T extends EventEmitter.EventNames<RoomEventCallbacks>>(event: T, ...args: EventEmitter.EventArgs<RoomEventCallbacks, T>): boolean;
205
+ emit<E extends keyof RoomEventCallbacks>(event: E, ...args: Parameters<RoomEventCallbacks[E]>): boolean;
202
206
  }
203
207
  export default Room;
204
208
  export type RoomEventCallbacks = {
@@ -1,6 +1,6 @@
1
1
  import type { InternalRoomOptions } from '../../options';
2
- import { DataPacket_Kind, ParticipantInfo, ParticipantPermission } from '../../proto/livekit_models';
3
- import { DataChannelInfo, TrackPublishedResponse } from '../../proto/livekit_rtc';
2
+ import { DataPacket_Kind, ParticipantInfo, ParticipantPermission } from '../../proto/livekit_models_pb';
3
+ import { DataChannelInfo, TrackPublishedResponse } from '../../proto/livekit_rtc_pb';
4
4
  import type RTCEngine from '../RTCEngine';
5
5
  import LocalTrack from '../track/LocalTrack';
6
6
  import LocalTrackPublication from '../track/LocalTrackPublication';
@@ -1,5 +1,5 @@
1
- import EventEmitter from 'eventemitter3';
2
- import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '../../proto/livekit_models';
1
+ import type TypedEmitter from 'typed-emitter';
2
+ import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '../../proto/livekit_models_pb';
3
3
  import type LocalTrackPublication from '../track/LocalTrackPublication';
4
4
  import type RemoteTrack from '../track/RemoteTrack';
5
5
  import type RemoteTrackPublication from '../track/RemoteTrackPublication';
@@ -11,7 +11,8 @@ export declare enum ConnectionQuality {
11
11
  Poor = "poor",
12
12
  Unknown = "unknown"
13
13
  }
14
- export default class Participant extends EventEmitter<ParticipantEventCallbacks> {
14
+ declare const Participant_base: new () => TypedEmitter<ParticipantEventCallbacks>;
15
+ export default class Participant extends Participant_base {
15
16
  protected participantInfo?: ParticipantInfo;
16
17
  audioTracks: Map<string, TrackPublication>;
17
18
  videoTracks: Map<string, TrackPublication>;
@@ -90,4 +91,5 @@ export type ParticipantEventCallbacks = {
90
91
  participantPermissionsChanged: (prevPermissions?: ParticipantPermission) => void;
91
92
  trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus) => void;
92
93
  };
94
+ export {};
93
95
  //# sourceMappingURL=Participant.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { TrackPermission } from '../../proto/livekit_rtc';
1
+ import { TrackPermission } from '../../proto/livekit_rtc_pb';
2
2
  export interface ParticipantTrackPermission {
3
3
  /**
4
4
  * The participant identity this permission applies to.
@@ -1,6 +1,5 @@
1
- import type EventEmitter from 'eventemitter3';
2
1
  import type { SignalClient } from '../../api/SignalClient';
3
- import type { ParticipantInfo } from '../../proto/livekit_models';
2
+ import type { ParticipantInfo } from '../../proto/livekit_models_pb';
4
3
  import RemoteTrackPublication from '../track/RemoteTrackPublication';
5
4
  import { Track } from '../track/Track';
6
5
  import type { AudioOutputOptions } from '../track/options';
@@ -12,7 +11,7 @@ export default class RemoteParticipant extends Participant {
12
11
  videoTracks: Map<string, RemoteTrackPublication>;
13
12
  tracks: Map<string, RemoteTrackPublication>;
14
13
  signalClient: SignalClient;
15
- private volume?;
14
+ private volumeMap;
16
15
  private audioContext?;
17
16
  private audioOutput?;
18
17
  /** @internal */
@@ -23,14 +22,16 @@ export default class RemoteParticipant extends Participant {
23
22
  getTrack(source: Track.Source): RemoteTrackPublication | undefined;
24
23
  getTrackByName(name: string): RemoteTrackPublication | undefined;
25
24
  /**
26
- * sets the volume on the participant's microphone track
25
+ * sets the volume on the participant's audio track
26
+ * by default, this affects the microphone publication
27
+ * a different source can be passed in as a second argument
27
28
  * if no track exists the volume will be applied when the microphone track is added
28
29
  */
29
- setVolume(volume: number): void;
30
+ setVolume(volume: number, source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): void;
30
31
  /**
31
32
  * gets the volume on the participant's microphone track
32
33
  */
33
- getVolume(): number | undefined;
34
+ getVolume(source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): number | undefined;
34
35
  /** @internal */
35
36
  addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver?: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
36
37
  /** @internal */
@@ -49,6 +50,6 @@ export default class RemoteParticipant extends Participant {
49
50
  */
50
51
  setAudioOutput(output: AudioOutputOptions): Promise<void>;
51
52
  /** @internal */
52
- emit<T extends EventEmitter.EventNames<ParticipantEventCallbacks>>(event: T, ...args: EventEmitter.EventArgs<ParticipantEventCallbacks, T>): boolean;
53
+ emit<E extends keyof ParticipantEventCallbacks>(event: E, ...args: Parameters<ParticipantEventCallbacks[E]>): boolean;
53
54
  }
54
55
  //# sourceMappingURL=RemoteParticipant.d.ts.map
@@ -1,12 +1,13 @@
1
+ /// <reference types="node" />
1
2
  /**
2
3
  * Timers that can be overridden with platform specific implementations
3
4
  * that ensure that they are fired. These should be used when it is critical
4
5
  * that the timer fires on time.
5
6
  */
6
7
  export default class CriticalTimers {
7
- static setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...arguments: any[]) => number;
8
- static setInterval: (handler: TimerHandler, timeout?: number | undefined, ...arguments: any[]) => number;
9
- static clearTimeout: (id: number | undefined) => void;
10
- static clearInterval: (id: number | undefined) => void;
8
+ static setTimeout: (callback: (args: void) => void, ms?: number | undefined) => NodeJS.Timeout;
9
+ static setInterval: (callback: (args: void) => void, ms?: number | undefined) => NodeJS.Timer;
10
+ static clearTimeout: (timeoutId: NodeJS.Timeout) => void;
11
+ static clearInterval: (intervalId: NodeJS.Timeout) => void;
11
12
  }
12
13
  //# sourceMappingURL=timers.d.ts.map
@@ -43,6 +43,9 @@ export default abstract class LocalTrack extends Track {
43
43
  protected setTrackMuted(muted: boolean): void;
44
44
  protected get needsReAcquisition(): boolean;
45
45
  protected handleAppVisibilityChanged(): Promise<void>;
46
+ private handleTrackMuteEvent;
47
+ private debouncedTrackMuteHandler;
48
+ private handleTrackUnmuteEvent;
46
49
  private handleEnded;
47
50
  stop(): void;
48
51
  /**
@@ -1,4 +1,4 @@
1
- import type { TrackInfo } from '../../proto/livekit_models';
1
+ import type { TrackInfo } from '../../proto/livekit_models_pb';
2
2
  import type LocalAudioTrack from './LocalAudioTrack';
3
3
  import type LocalTrack from './LocalTrack';
4
4
  import type LocalVideoTrack from './LocalVideoTrack';
@@ -1,6 +1,6 @@
1
1
  import type { SignalClient } from '../../api/SignalClient';
2
- import { VideoLayer, VideoQuality } from '../../proto/livekit_models';
3
- import type { SubscribedCodec, SubscribedQuality } from '../../proto/livekit_rtc';
2
+ import { VideoLayer, VideoQuality } from '../../proto/livekit_models_pb';
3
+ import { SubscribedCodec, SubscribedQuality } from '../../proto/livekit_rtc_pb';
4
4
  import type { VideoSenderStats } from '../stats';
5
5
  import LocalTrack from './LocalTrack';
6
6
  import type { VideoCaptureOptions, VideoCodec } from './options';
@@ -1,4 +1,4 @@
1
- import { SubscriptionError, TrackInfo, VideoQuality } from '../../proto/livekit_models';
1
+ import { SubscriptionError, TrackInfo, VideoQuality } from '../../proto/livekit_models_pb';
2
2
  import type RemoteTrack from './RemoteTrack';
3
3
  import { Track } from './Track';
4
4
  import { TrackPublication } from './TrackPublication';
@@ -1,8 +1,9 @@
1
- import EventEmitter from 'eventemitter3';
1
+ import type TypedEventEmitter from 'typed-emitter';
2
2
  import type { SignalClient } from '../../api/SignalClient';
3
- import { TrackSource, TrackType } from '../../proto/livekit_models';
4
- import { StreamState as ProtoStreamState } from '../../proto/livekit_rtc';
5
- export declare abstract class Track extends EventEmitter<TrackEventCallbacks> {
3
+ import { TrackSource, TrackType } from '../../proto/livekit_models_pb';
4
+ import { StreamState as ProtoStreamState } from '../../proto/livekit_rtc_pb';
5
+ declare const Track_base: new () => TypedEventEmitter<TrackEventCallbacks>;
6
+ export declare abstract class Track extends Track_base {
6
7
  kind: Track.Kind;
7
8
  attachedElements: HTMLMediaElement[];
8
9
  isMuted: boolean;
@@ -120,4 +121,5 @@ export type TrackEventCallbacks = {
120
121
  upstreamPaused: (track: any) => void;
121
122
  upstreamResumed: (track: any) => void;
122
123
  };
124
+ export {};
123
125
  //# sourceMappingURL=Track.d.ts.map
@@ -1,14 +1,15 @@
1
- import EventEmitter from 'eventemitter3';
2
- import { Encryption_Type } from '../../proto/livekit_models';
3
- import type { SubscriptionError, TrackInfo } from '../../proto/livekit_models';
4
- import type { UpdateSubscription, UpdateTrackSettings } from '../../proto/livekit_rtc';
1
+ import type TypedEventEmitter from 'typed-emitter';
2
+ import { Encryption_Type } from '../../proto/livekit_models_pb';
3
+ import type { SubscriptionError, TrackInfo } from '../../proto/livekit_models_pb';
4
+ import type { UpdateSubscription, UpdateTrackSettings } from '../../proto/livekit_rtc_pb';
5
5
  import LocalAudioTrack from './LocalAudioTrack';
6
6
  import LocalVideoTrack from './LocalVideoTrack';
7
7
  import RemoteAudioTrack from './RemoteAudioTrack';
8
8
  import type RemoteTrack from './RemoteTrack';
9
9
  import RemoteVideoTrack from './RemoteVideoTrack';
10
10
  import { Track } from './Track';
11
- export declare class TrackPublication extends EventEmitter<PublicationEventCallbacks> {
11
+ declare const TrackPublication_base: new () => TypedEventEmitter<PublicationEventCallbacks>;
12
+ export declare class TrackPublication extends TrackPublication_base {
12
13
  kind: Track.Kind;
13
14
  trackName: string;
14
15
  trackSid: Track.SID;
@@ -67,4 +68,5 @@ export type PublicationEventCallbacks = {
67
68
  subscriptionStatusChanged: (status: TrackPublication.SubscriptionStatus, prevStatus: TrackPublication.SubscriptionStatus) => void;
68
69
  subscriptionFailed: (error: SubscriptionError) => void;
69
70
  };
71
+ export {};
70
72
  //# sourceMappingURL=TrackPublication.d.ts.map
@@ -127,6 +127,13 @@ export interface ScreenShareCaptureOptions {
127
127
  * screenshare is limited: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia#browser_compatibility
128
128
  */
129
129
  audio?: boolean | AudioCaptureOptions;
130
+ /**
131
+ * only allows for 'true' and chrome allows for additional options to be passed in
132
+ * https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface
133
+ */
134
+ video?: true | {
135
+ displaySurface?: 'window' | 'browser' | 'monitor';
136
+ };
130
137
  /** capture resolution, defaults to full HD */
131
138
  resolution?: VideoResolution;
132
139
  /** a CaptureController object instance containing methods that can be used to further manipulate the capture session if included. */
@@ -1,5 +1,5 @@
1
1
  import { Track } from './Track';
2
- import type { AudioCaptureOptions, CreateLocalTracksOptions, VideoCaptureOptions } from './options';
2
+ import type { AudioCaptureOptions, CreateLocalTracksOptions, ScreenShareCaptureOptions, VideoCaptureOptions } from './options';
3
3
  import type { AudioTrack } from './types';
4
4
  export declare function mergeDefaultOptions(options?: CreateLocalTracksOptions, audioDefaults?: AudioCaptureOptions, videoDefaults?: VideoCaptureOptions): CreateLocalTracksOptions;
5
5
  export declare function constraintsForOptions(options: CreateLocalTracksOptions): MediaStreamConstraints;
@@ -20,4 +20,8 @@ export declare function kindToSource(kind: MediaDeviceKind): Track.Source.Camera
20
20
  * @internal
21
21
  */
22
22
  export declare function sourceToKind(source: Track.Source): MediaDeviceKind | undefined;
23
+ /**
24
+ * @internal
25
+ */
26
+ export declare function screenCaptureToDisplayMediaStreamOptions(options: ScreenShareCaptureOptions): DisplayMediaStreamOptions;
23
27
  //# sourceMappingURL=utils.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ClientInfo } from '../proto/livekit_models';
1
+ import { ClientInfo } from '../proto/livekit_models_pb';
2
2
  import type LocalAudioTrack from './track/LocalAudioTrack';
3
3
  import type RemoteAudioTrack from './track/RemoteAudioTrack';
4
4
  import { VideoCodec } from './track/options';
@@ -87,4 +87,6 @@ export declare class Mutex {
87
87
  }
88
88
  export declare function isVideoCodec(maybeCodec: string): maybeCodec is VideoCodec;
89
89
  export declare function unwrapConstraint(constraint: ConstrainDOMString): string;
90
+ export declare function toWebsocketUrl(url: string): string;
91
+ export declare function toHttpUrl(url: string): string;
90
92
  //# sourceMappingURL=utils.d.ts.map
@@ -1,10 +1,11 @@
1
+ import { MockedClass } from 'vitest';
1
2
  import { SignalClient } from '../api/SignalClient';
2
3
  import RTCEngine from '../room/RTCEngine';
3
4
  declare const mocks: {
4
- SignalClient: jest.MockedClass<typeof SignalClient>;
5
- RTCEngine: jest.MockedClass<typeof RTCEngine>;
5
+ SignalClient: MockedClass<typeof SignalClient>;
6
+ RTCEngine: MockedClass<typeof RTCEngine>;
6
7
  MockLocalVideoTrack: {
7
- stop: jest.Mock<any, any, any>;
8
+ stop: import("@vitest/spy").Mock<any, any>;
8
9
  };
9
10
  };
10
11
  export default mocks;
@@ -1,7 +1,9 @@
1
1
  export type DetectableBrowser = 'Chrome' | 'Firefox' | 'Safari';
2
+ export type DetectableOS = 'iOS' | 'macOS';
2
3
  export type BrowserDetails = {
3
4
  name: DetectableBrowser;
4
5
  version: string;
6
+ os?: DetectableOS;
5
7
  };
6
8
  /**
7
9
  * @internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livekit-client",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
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",
@@ -39,10 +39,10 @@
39
39
  "build": "rollup --config --bundleConfigAsCjs && rollup --config rollup.config.worker.js --bundleConfigAsCjs && yarn downlevel-dts",
40
40
  "build:watch": "rollup --watch --config rollup.config.js",
41
41
  "build-docs": "typedoc",
42
- "proto": "protoc --plugin=node_modules/ts-proto/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_out=./src/proto --ts_proto_opt=outputClientImpl=false,useOptionals=messages,oneof=unions -I./protocol ./protocol/livekit_rtc.proto ./protocol/livekit_models.proto",
42
+ "proto": "protoc --es_out src/proto --es_opt target=ts -I./protocol ./protocol/livekit_rtc.proto ./protocol/livekit_models.proto",
43
43
  "sample": "vite example -c vite.config.js",
44
44
  "lint": "eslint src",
45
- "test": "jest",
45
+ "test": "vitest run src",
46
46
  "deploy": "gh-pages -d example/dist",
47
47
  "format": "prettier --write src example/sample.ts",
48
48
  "format:check": "prettier --check src",
@@ -52,16 +52,18 @@
52
52
  "size-limit": "size-limit"
53
53
  },
54
54
  "dependencies": {
55
- "eventemitter3": "^5.0.1",
55
+ "@bufbuild/protobuf": "^1.3.0",
56
+ "events": "^3.3.0",
56
57
  "loglevel": "^1.8.0",
57
- "protobufjs": "^7.0.0",
58
58
  "sdp-transform": "^2.14.1",
59
59
  "ts-debounce": "^4.0.0",
60
+ "typed-emitter": "^2.1.0",
60
61
  "webrtc-adapter": "^8.1.1"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@babel/core": "7.22.1",
64
65
  "@babel/preset-env": "7.22.4",
66
+ "@bufbuild/protoc-gen-es": "^1.3.0",
65
67
  "@changesets/cli": "2.26.1",
66
68
  "@livekit/changesets-changelog-github": "^0.0.4",
67
69
  "@rollup/plugin-babel": "6.0.3",
@@ -73,7 +75,6 @@
73
75
  "@size-limit/webpack": "^8.2.4",
74
76
  "@trivago/prettier-plugin-sort-imports": "^4.1.1",
75
77
  "@types/events": "^3.0.0",
76
- "@types/jest": "29.5.2",
77
78
  "@types/sdp-transform": "2.4.6",
78
79
  "@types/ua-parser-js": "0.7.36",
79
80
  "@typescript-eslint/eslint-plugin": "5.59.8",
@@ -85,19 +86,18 @@
85
86
  "eslint-plugin-ecmascript-compat": "^3.0.0",
86
87
  "eslint-plugin-import": "2.27.5",
87
88
  "gh-pages": "5.0.0",
88
- "jest": "29.5.0",
89
- "jest-environment-jsdom": "^29.5.0",
89
+ "jsdom": "^22.1.0",
90
90
  "prettier": "^2.8.8",
91
91
  "rollup": "3.23.1",
92
92
  "rollup-plugin-delete": "^2.0.0",
93
93
  "rollup-plugin-re": "1.0.7",
94
94
  "rollup-plugin-typescript2": "0.34.1",
95
95
  "size-limit": "^8.2.4",
96
- "ts-jest": "29.1.0",
97
96
  "ts-proto": "1.148.2",
98
97
  "typedoc": "0.24.8",
99
98
  "typedoc-plugin-no-inherit": "1.4.0",
100
99
  "typescript": "5.1.3",
101
- "vite": "4.3.9"
100
+ "vite": "4.3.9",
101
+ "vitest": "^0.32.0"
102
102
  }
103
103
  }