@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.
- package/README.md +19 -11
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +301 -389
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +15291 -13060
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +2 -2
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +2 -3
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts +2 -3
- package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/webrtc.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/websocket.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts +2 -4
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/KeyProvider.d.ts +2 -4
- package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
- package/dist/src/e2ee/constants.d.ts +0 -1
- package/dist/src/e2ee/constants.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +0 -1
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts +2 -4
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +3 -14
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts +146 -0
- package/dist/src/proto/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/src/proto/livekit_models.d.ts +2399 -0
- package/dist/src/proto/livekit_models.d.ts.map +1 -0
- package/dist/src/proto/livekit_rtc.d.ts +14352 -0
- package/dist/src/proto/livekit_rtc.d.ts.map +1 -0
- package/dist/src/room/PCTransport.d.ts +1 -2
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +5 -9
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/RegionUrlProvider.d.ts +1 -4
- package/dist/src/room/RegionUrlProvider.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +11 -15
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +2 -2
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +3 -5
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
- package/dist/src/room/participant/ParticipantTrackPermission.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +3 -2
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/timers.d.ts +4 -5
- package/dist/src/room/timers.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrackPublication.d.ts +1 -1
- package/dist/src/room/track/LocalTrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +2 -2
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrackPublication.d.ts +1 -1
- package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +4 -6
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/src/room/track/TrackPublication.d.ts +5 -7
- package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +0 -7
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +1 -5
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -3
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/mocks.d.ts +4 -4
- package/dist/src/test/mocks.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +2 -2
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -3
- package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +2 -3
- package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +2 -4
- package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +2 -4
- package/dist/ts4.2/src/e2ee/constants.d.ts +0 -1
- package/dist/ts4.2/src/e2ee/types.d.ts +0 -1
- package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +2 -4
- package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +3 -14
- package/dist/ts4.2/src/index.d.ts +1 -1
- package/dist/ts4.2/src/proto/google/protobuf/timestamp.d.ts +150 -0
- package/dist/ts4.2/src/proto/livekit_models.d.ts +2659 -0
- package/dist/ts4.2/src/proto/livekit_rtc.d.ts +15764 -0
- package/dist/ts4.2/src/room/PCTransport.d.ts +1 -2
- package/dist/ts4.2/src/room/RTCEngine.d.ts +5 -9
- package/dist/ts4.2/src/room/RegionUrlProvider.d.ts +1 -4
- package/dist/ts4.2/src/room/Room.d.ts +11 -15
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +2 -2
- package/dist/ts4.2/src/room/participant/Participant.d.ts +3 -5
- package/dist/ts4.2/src/room/participant/ParticipantTrackPermission.d.ts +1 -1
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +3 -2
- package/dist/ts4.2/src/room/timers.d.ts +4 -5
- package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +2 -2
- package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +1 -1
- package/dist/ts4.2/src/room/track/Track.d.ts +4 -6
- package/dist/ts4.2/src/room/track/TrackPublication.d.ts +5 -7
- package/dist/ts4.2/src/room/track/options.d.ts +0 -7
- package/dist/ts4.2/src/room/track/utils.d.ts +1 -5
- package/dist/ts4.2/src/room/utils.d.ts +1 -3
- package/dist/ts4.2/src/test/mocks.d.ts +4 -4
- package/package.json +11 -11
- package/src/api/SignalClient.ts +101 -104
- package/src/connectionHelper/ConnectionCheck.ts +2 -3
- package/src/connectionHelper/checks/Checker.ts +3 -3
- package/src/connectionHelper/checks/webrtc.ts +2 -66
- package/src/connectionHelper/checks/websocket.ts +0 -4
- package/src/e2ee/E2eeManager.ts +3 -4
- package/src/e2ee/KeyProvider.ts +2 -3
- package/src/e2ee/constants.ts +0 -4
- package/src/e2ee/types.ts +0 -1
- package/src/e2ee/worker/FrameCryptor.test.ts +3 -1
- package/src/e2ee/worker/FrameCryptor.ts +5 -5
- package/src/e2ee/worker/ParticipantKeyHandler.ts +6 -37
- package/src/e2ee/worker/e2ee.worker.ts +1 -1
- package/src/index.ts +1 -1
- package/src/proto/google/protobuf/timestamp.ts +230 -0
- package/src/proto/livekit_models.ts +4006 -0
- package/src/proto/livekit_rtc.ts +4672 -0
- package/src/room/PCTransport.ts +1 -1
- package/src/room/RTCEngine.ts +18 -24
- package/src/room/RegionUrlProvider.ts +2 -11
- package/src/room/Room.test.ts +0 -1
- package/src/room/Room.ts +79 -158
- package/src/room/participant/LocalParticipant.ts +59 -43
- package/src/room/participant/Participant.ts +4 -6
- package/src/room/participant/ParticipantTrackPermission.ts +3 -3
- package/src/room/participant/RemoteParticipant.ts +6 -5
- package/src/room/participant/publishUtils.test.ts +0 -1
- package/src/room/track/LocalTrackPublication.ts +1 -1
- package/src/room/track/LocalVideoTrack.test.ts +1 -2
- package/src/room/track/LocalVideoTrack.ts +22 -22
- package/src/room/track/RemoteTrackPublication.ts +7 -12
- package/src/room/track/RemoteVideoTrack.test.ts +4 -5
- package/src/room/track/Track.ts +6 -9
- package/src/room/track/TrackPublication.ts +5 -7
- package/src/room/track/create.ts +17 -9
- package/src/room/track/facingMode.test.ts +0 -1
- package/src/room/track/options.ts +0 -6
- package/src/room/track/utils.test.ts +0 -1
- package/src/room/track/utils.ts +2 -44
- package/src/room/utils.ts +4 -20
- package/src/test/mocks.ts +5 -7
- package/src/utils/AsyncQueue.test.ts +0 -1
- package/src/utils/browserParser.test.ts +3 -33
- package/src/utils/browserParser.ts +1 -1
- package/dist/src/proto/livekit_models_pb.d.ts +0 -1264
- package/dist/src/proto/livekit_models_pb.d.ts.map +0 -1
- package/dist/src/proto/livekit_rtc_pb.d.ts +0 -1373
- package/dist/src/proto/livekit_rtc_pb.d.ts.map +0 -1
- package/dist/ts4.2/src/proto/livekit_models_pb.d.ts +0 -1264
- package/dist/ts4.2/src/proto/livekit_rtc_pb.d.ts +0 -1373
- package/src/proto/livekit_models_pb.ts +0 -2096
- package/src/proto/livekit_rtc_pb.ts +0 -2332
- package/src/room/utils.test.ts +0 -16
package/src/room/track/utils.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
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/
|
|
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 =
|
|
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
|
-
|
|
7
|
-
|
|
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:
|
|
13
|
+
stop: jest.fn(),
|
|
16
14
|
},
|
|
17
15
|
};
|
|
18
16
|
|
|
@@ -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
|
|
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
|
|
28
|
-
const details = getBrowser(
|
|
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');
|