@dtelecom/livekit-client 1.12.4 → 1.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +19 -11
  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 +301 -389
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +15291 -13060
  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 +2 -3
  13. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  14. package/dist/src/connectionHelper/checks/Checker.d.ts +2 -3
  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 +2 -4
  19. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  20. package/dist/src/e2ee/KeyProvider.d.ts +2 -4
  21. package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
  22. package/dist/src/e2ee/constants.d.ts +0 -1
  23. package/dist/src/e2ee/constants.d.ts.map +1 -1
  24. package/dist/src/e2ee/types.d.ts +0 -1
  25. package/dist/src/e2ee/types.d.ts.map +1 -1
  26. package/dist/src/e2ee/worker/FrameCryptor.d.ts +2 -4
  27. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  28. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +3 -14
  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/google/protobuf/timestamp.d.ts +146 -0
  33. package/dist/src/proto/google/protobuf/timestamp.d.ts.map +1 -0
  34. package/dist/src/proto/livekit_models.d.ts +2399 -0
  35. package/dist/src/proto/livekit_models.d.ts.map +1 -0
  36. package/dist/src/proto/livekit_rtc.d.ts +14352 -0
  37. package/dist/src/proto/livekit_rtc.d.ts.map +1 -0
  38. package/dist/src/room/PCTransport.d.ts +1 -2
  39. package/dist/src/room/PCTransport.d.ts.map +1 -1
  40. package/dist/src/room/RTCEngine.d.ts +5 -9
  41. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  42. package/dist/src/room/RegionUrlProvider.d.ts +1 -4
  43. package/dist/src/room/RegionUrlProvider.d.ts.map +1 -1
  44. package/dist/src/room/Room.d.ts +11 -15
  45. package/dist/src/room/Room.d.ts.map +1 -1
  46. package/dist/src/room/participant/LocalParticipant.d.ts +2 -2
  47. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  48. package/dist/src/room/participant/Participant.d.ts +3 -5
  49. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  50. package/dist/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
  51. package/dist/src/room/participant/ParticipantTrackPermission.d.ts.map +1 -1
  52. package/dist/src/room/participant/RemoteParticipant.d.ts +3 -2
  53. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  54. package/dist/src/room/timers.d.ts +4 -5
  55. package/dist/src/room/timers.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 +4 -6
  63. package/dist/src/room/track/Track.d.ts.map +1 -1
  64. package/dist/src/room/track/TrackPublication.d.ts +5 -7
  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 +0 -7
  68. package/dist/src/room/track/options.d.ts.map +1 -1
  69. package/dist/src/room/track/utils.d.ts +1 -5
  70. package/dist/src/room/track/utils.d.ts.map +1 -1
  71. package/dist/src/room/utils.d.ts +1 -3
  72. package/dist/src/room/utils.d.ts.map +1 -1
  73. package/dist/src/test/mocks.d.ts +4 -4
  74. package/dist/src/test/mocks.d.ts.map +1 -1
  75. package/dist/ts4.2/src/api/SignalClient.d.ts +2 -2
  76. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -3
  77. package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +2 -3
  78. package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +2 -4
  79. package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +2 -4
  80. package/dist/ts4.2/src/e2ee/constants.d.ts +0 -1
  81. package/dist/ts4.2/src/e2ee/types.d.ts +0 -1
  82. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +2 -4
  83. package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +3 -14
  84. package/dist/ts4.2/src/index.d.ts +1 -1
  85. package/dist/ts4.2/src/proto/google/protobuf/timestamp.d.ts +150 -0
  86. package/dist/ts4.2/src/proto/livekit_models.d.ts +2659 -0
  87. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +15764 -0
  88. package/dist/ts4.2/src/room/PCTransport.d.ts +1 -2
  89. package/dist/ts4.2/src/room/RTCEngine.d.ts +5 -9
  90. package/dist/ts4.2/src/room/RegionUrlProvider.d.ts +1 -4
  91. package/dist/ts4.2/src/room/Room.d.ts +11 -15
  92. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +2 -2
  93. package/dist/ts4.2/src/room/participant/Participant.d.ts +3 -5
  94. package/dist/ts4.2/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
  95. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +3 -2
  96. package/dist/ts4.2/src/room/timers.d.ts +4 -5
  97. package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +1 -1
  98. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +2 -2
  99. package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +1 -1
  100. package/dist/ts4.2/src/room/track/Track.d.ts +4 -6
  101. package/dist/ts4.2/src/room/track/TrackPublication.d.ts +5 -7
  102. package/dist/ts4.2/src/room/track/options.d.ts +0 -7
  103. package/dist/ts4.2/src/room/track/utils.d.ts +1 -5
  104. package/dist/ts4.2/src/room/utils.d.ts +1 -3
  105. package/dist/ts4.2/src/test/mocks.d.ts +4 -4
  106. package/package.json +11 -11
  107. package/src/api/SignalClient.ts +101 -104
  108. package/src/connectionHelper/ConnectionCheck.ts +2 -3
  109. package/src/connectionHelper/checks/Checker.ts +3 -3
  110. package/src/connectionHelper/checks/webrtc.ts +2 -66
  111. package/src/connectionHelper/checks/websocket.ts +0 -4
  112. package/src/e2ee/E2eeManager.ts +3 -4
  113. package/src/e2ee/KeyProvider.ts +2 -3
  114. package/src/e2ee/constants.ts +0 -4
  115. package/src/e2ee/types.ts +0 -1
  116. package/src/e2ee/worker/FrameCryptor.test.ts +3 -1
  117. package/src/e2ee/worker/FrameCryptor.ts +5 -5
  118. package/src/e2ee/worker/ParticipantKeyHandler.ts +6 -37
  119. package/src/e2ee/worker/e2ee.worker.ts +1 -1
  120. package/src/index.ts +1 -1
  121. package/src/proto/google/protobuf/timestamp.ts +230 -0
  122. package/src/proto/livekit_models.ts +4006 -0
  123. package/src/proto/livekit_rtc.ts +4672 -0
  124. package/src/room/PCTransport.ts +1 -1
  125. package/src/room/RTCEngine.ts +18 -24
  126. package/src/room/RegionUrlProvider.ts +2 -11
  127. package/src/room/Room.test.ts +0 -1
  128. package/src/room/Room.ts +79 -158
  129. package/src/room/participant/LocalParticipant.ts +59 -43
  130. package/src/room/participant/Participant.ts +4 -6
  131. package/src/room/participant/ParticipantTrackPermission.ts +3 -3
  132. package/src/room/participant/RemoteParticipant.ts +6 -5
  133. package/src/room/participant/publishUtils.test.ts +0 -1
  134. package/src/room/track/LocalTrackPublication.ts +1 -1
  135. package/src/room/track/LocalVideoTrack.test.ts +1 -2
  136. package/src/room/track/LocalVideoTrack.ts +22 -22
  137. package/src/room/track/RemoteTrackPublication.ts +7 -12
  138. package/src/room/track/RemoteVideoTrack.test.ts +4 -5
  139. package/src/room/track/Track.ts +6 -9
  140. package/src/room/track/TrackPublication.ts +5 -7
  141. package/src/room/track/create.ts +17 -9
  142. package/src/room/track/facingMode.test.ts +0 -1
  143. package/src/room/track/options.ts +0 -6
  144. package/src/room/track/utils.test.ts +0 -1
  145. package/src/room/track/utils.ts +2 -44
  146. package/src/room/utils.ts +4 -20
  147. package/src/test/mocks.ts +5 -7
  148. package/src/utils/AsyncQueue.test.ts +0 -1
  149. package/src/utils/browserParser.test.ts +3 -33
  150. package/src/utils/browserParser.ts +1 -1
  151. package/dist/src/proto/livekit_models_pb.d.ts +0 -1264
  152. package/dist/src/proto/livekit_models_pb.d.ts.map +0 -1
  153. package/dist/src/proto/livekit_rtc_pb.d.ts +0 -1373
  154. package/dist/src/proto/livekit_rtc_pb.d.ts.map +0 -1
  155. package/dist/ts4.2/src/proto/livekit_models_pb.d.ts +0 -1264
  156. package/dist/ts4.2/src/proto/livekit_rtc_pb.d.ts +0 -1373
  157. package/src/proto/livekit_models_pb.ts +0 -2096
  158. package/src/proto/livekit_rtc_pb.ts +0 -2332
  159. package/src/room/utils.test.ts +0 -16
@@ -1,11 +1,6 @@
1
- import { isSafari, sleep } from '../utils';
1
+ import { sleep } from '../utils';
2
2
  import { Track } from './Track';
3
- import type {
4
- AudioCaptureOptions,
5
- CreateLocalTracksOptions,
6
- ScreenShareCaptureOptions,
7
- VideoCaptureOptions,
8
- } from './options';
3
+ import type { AudioCaptureOptions, CreateLocalTracksOptions, VideoCaptureOptions } from './options';
9
4
  import type { AudioTrack } from './types';
10
5
 
11
6
  export function mergeDefaultOptions(
@@ -144,40 +139,3 @@ export function sourceToKind(source: Track.Source): MediaDeviceKind | undefined
144
139
  return undefined;
145
140
  }
146
141
  }
147
-
148
- /**
149
- * @internal
150
- */
151
- export function screenCaptureToDisplayMediaStreamOptions(
152
- options: ScreenShareCaptureOptions,
153
- ): DisplayMediaStreamOptions {
154
- let videoConstraints: MediaTrackConstraints | boolean = options.video ?? true;
155
- if (options.resolution) {
156
- videoConstraints = typeof videoConstraints === 'boolean' ? {} : videoConstraints;
157
- if (isSafari()) {
158
- videoConstraints = {
159
- ...videoConstraints,
160
- width: { max: options.resolution.width },
161
- height: { max: options.resolution.height },
162
- frameRate: options.resolution.frameRate,
163
- };
164
- } else {
165
- videoConstraints = {
166
- ...videoConstraints,
167
- width: { ideal: options.resolution.width },
168
- height: { ideal: options.resolution.height },
169
- frameRate: options.resolution.frameRate,
170
- };
171
- }
172
- }
173
-
174
- return {
175
- audio: options.audio ?? false,
176
- video: videoConstraints,
177
- // @ts-expect-error support for experimental display media features
178
- controller: options.controller,
179
- selfBrowserSurface: options.selfBrowserSurface,
180
- surfaceSwitching: options.surfaceSwitching,
181
- systemAudio: options.systemAudio,
182
- };
183
- }
package/src/room/utils.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ClientInfo, ClientInfo_SDK } from '../proto/livekit_models_pb';
2
- import type { DetectableBrowser } from '../utils/browserParser';
1
+ import { ClientInfo, ClientInfo_SDK } from '../proto/livekit_models';
3
2
  import { getBrowser } from '../utils/browserParser';
3
+ import type { DetectableBrowser } from '../utils/browserParser';
4
4
  import { protocolVersion, version } from '../version';
5
5
  import type LocalAudioTrack from './track/LocalAudioTrack';
6
6
  import type RemoteAudioTrack from './track/RemoteAudioTrack';
@@ -148,9 +148,7 @@ export function isReactNative(): boolean {
148
148
  }
149
149
 
150
150
  export function isCloud(serverUrl: URL) {
151
- return (
152
- serverUrl.hostname.endsWith('.livekit.cloud') || serverUrl.hostname.endsWith('.livekit.run')
153
- );
151
+ return serverUrl.hostname.endsWith('.livekit.cloud');
154
152
  }
155
153
 
156
154
  function getLKReactNativeInfo(): LiveKitReactNativeInfo | undefined {
@@ -246,7 +244,7 @@ export interface ObservableMediaElement extends HTMLMediaElement {
246
244
  }
247
245
 
248
246
  export function getClientInfo(): ClientInfo {
249
- const info = new ClientInfo({
247
+ const info = ClientInfo.fromPartial({
250
248
  sdk: ClientInfo_SDK.JS,
251
249
  protocol: protocolVersion,
252
250
  version,
@@ -485,17 +483,3 @@ export function unwrapConstraint(constraint: ConstrainDOMString): string {
485
483
  }
486
484
  throw Error('could not unwrap constraint');
487
485
  }
488
-
489
- export function toWebsocketUrl(url: string): string {
490
- if (url.startsWith('http')) {
491
- return url.replace(/^(http)/, 'ws');
492
- }
493
- return url;
494
- }
495
-
496
- export function toHttpUrl(url: string): string {
497
- if (url.startsWith('ws')) {
498
- return url.replace(/^(ws)/, 'http');
499
- }
500
- return url;
501
- }
package/src/test/mocks.ts CHANGED
@@ -1,18 +1,16 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies
2
- import { MockedClass, vi } from 'vitest';
3
1
  import { SignalClient } from '../api/SignalClient';
4
2
  import RTCEngine from '../room/RTCEngine';
5
3
 
6
- vi.mock('../api/SignalClient');
7
- vi.mock('../room/RTCEngine');
4
+ jest.mock('../api/SignalClient');
5
+ jest.mock('../room/RTCEngine');
8
6
 
9
7
  // mock helpers for testing
10
8
 
11
9
  const mocks = {
12
- SignalClient: SignalClient as MockedClass<typeof SignalClient>,
13
- RTCEngine: RTCEngine as MockedClass<typeof RTCEngine>,
10
+ SignalClient: SignalClient as jest.MockedClass<typeof SignalClient>,
11
+ RTCEngine: RTCEngine as jest.MockedClass<typeof RTCEngine>,
14
12
  MockLocalVideoTrack: {
15
- stop: vi.fn(),
13
+ stop: jest.fn(),
16
14
  },
17
15
  };
18
16
 
@@ -1,4 +1,3 @@
1
- import { describe, expect, it } from 'vitest';
2
1
  import { sleep } from '../room/utils';
3
2
  import { AsyncQueue } from './AsyncQueue';
4
3
 
@@ -1,63 +1,33 @@
1
- import { describe, expect, it } from 'vitest';
2
1
  import { compareVersions } from '../room/utils';
3
2
  import { getBrowser } from './browserParser';
4
3
 
5
4
  describe('browser parser', () => {
6
- const macOSSafariUA =
5
+ const safariUA =
7
6
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15';
8
-
9
- const iOSSafariUA =
10
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Mobile/15E148 Safari/604.1';
11
-
12
7
  const firefoxUA =
13
8
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/112.0';
14
9
 
15
- const iOSFirefoxUA =
16
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/115.0 Mobile/15E148 Safari/605.1.15';
17
-
18
10
  const chromeUA =
19
11
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36';
20
12
 
21
- const iOSChromeUA =
22
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/115.0.5790.130 Mobile/15E148 Safari/604.11';
23
-
24
13
  const braveUA =
25
14
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36';
26
15
 
27
- it('parses Safari macOS correctly', () => {
28
- const details = getBrowser(macOSSafariUA, true);
16
+ it('parses Safari correctly', () => {
17
+ const details = getBrowser(safariUA, true);
29
18
  expect(details?.name).toBe('Safari');
30
19
  expect(details?.version).toBe('16.3');
31
- expect(details?.os).toBe('macOS');
32
- });
33
- it('parses Safari iOS correctly', () => {
34
- const details = getBrowser(iOSSafariUA, true);
35
- expect(details?.name).toBe('Safari');
36
- expect(details?.version).toBe('16.5');
37
- expect(details?.os).toBe('iOS');
38
20
  });
39
21
  it('parses Firefox correctly', () => {
40
22
  const details = getBrowser(firefoxUA, true);
41
23
  expect(details?.name).toBe('Firefox');
42
24
  expect(details?.version).toBe('112.0');
43
25
  });
44
- it('parses iOS Firefox correctly', () => {
45
- const details = getBrowser(iOSFirefoxUA, true);
46
- expect(details?.name).toBe('Firefox');
47
- expect(details?.version).toBe('115.0');
48
- expect(details?.os).toBe('iOS');
49
- });
50
26
  it('parses Chrome correctly', () => {
51
27
  const details = getBrowser(chromeUA, true);
52
28
  expect(details?.name).toBe('Chrome');
53
29
  expect(details?.version).toBe('112.0.0.0');
54
30
  });
55
- it('parses iOS Chrome correctly', () => {
56
- const details = getBrowser(iOSChromeUA, true);
57
- expect(details?.name).toBe('Chrome');
58
- expect(details?.version).toBe('115.0.5790.130');
59
- expect(details?.os).toBe('iOS');
60
- });
61
31
  it('detects brave as chromium based', () => {
62
32
  const details = getBrowser(braveUA, true);
63
33
  expect(details?.name).toBe('Chrome');
@@ -60,7 +60,7 @@ const browsersList = [
60
60
  const browser: BrowserDetails = {
61
61
  name: 'Safari',
62
62
  version: getMatch(commonVersionIdentifier, ua),
63
- os: ua.includes('mobile/') ? 'iOS' : 'macOS',
63
+ os: ua.includes('Mobile/') ? 'iOS' : 'macOS',
64
64
  };
65
65
 
66
66
  return browser;