livekit-client 1.7.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +21 -1
- package/dist/livekit-client.esm.mjs +14241 -12994
- 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 +11 -10
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts.map +1 -1
- package/dist/src/proto/livekit_models.d.ts +37 -0
- package/dist/src/proto/livekit_models.d.ts.map +1 -1
- package/dist/src/proto/livekit_rtc.d.ts +347 -75
- package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +12 -3
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/ReconnectPolicy.d.ts +1 -0
- package/dist/src/room/ReconnectPolicy.d.ts.map +1 -1
- package/dist/src/room/RegionUrlProvider.d.ts +14 -0
- package/dist/src/room/RegionUrlProvider.d.ts.map +1 -0
- package/dist/src/room/Room.d.ts +23 -15
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +2 -1
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +23 -2
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +14 -2
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +4 -2
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +2 -2
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +4 -3
- package/dist/src/room/track/LocalTrack.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.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +1 -1
- package/dist/src/room/track/RemoteAudioTrack.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/RemoteVideoTrack.d.ts +1 -1
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +3 -1
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/types.d.ts +5 -0
- package/dist/src/room/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +4 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +14 -10
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +1 -1
- package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +1 -1
- package/dist/ts4.2/src/index.d.ts +7 -6
- package/dist/ts4.2/src/proto/livekit_models.d.ts +37 -0
- package/dist/ts4.2/src/proto/livekit_rtc.d.ts +380 -84
- package/dist/ts4.2/src/room/RTCEngine.d.ts +12 -3
- package/dist/ts4.2/src/room/ReconnectPolicy.d.ts +1 -0
- package/dist/ts4.2/src/room/RegionUrlProvider.d.ts +14 -0
- package/dist/ts4.2/src/room/Room.d.ts +23 -15
- package/dist/ts4.2/src/room/errors.d.ts +2 -1
- package/dist/ts4.2/src/room/events.d.ts +23 -2
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +14 -2
- package/dist/ts4.2/src/room/participant/Participant.d.ts +4 -2
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -2
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +4 -3
- package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +1 -1
- package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +1 -1
- package/dist/ts4.2/src/room/track/RemoteVideoTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/Track.d.ts +3 -1
- package/dist/ts4.2/src/room/types.d.ts +5 -0
- package/dist/ts4.2/src/room/utils.d.ts +4 -0
- package/package.json +21 -20
- package/src/api/SignalClient.ts +41 -29
- package/src/connectionHelper/ConnectionCheck.ts +1 -2
- package/src/connectionHelper/checks/Checker.ts +1 -1
- package/src/connectionHelper/checks/reconnect.ts +1 -1
- package/src/index.ts +9 -8
- package/src/proto/google/protobuf/timestamp.ts +15 -6
- package/src/proto/livekit_models.ts +917 -221
- package/src/proto/livekit_rtc.ts +1053 -279
- package/src/room/RTCEngine.ts +171 -47
- package/src/room/ReconnectPolicy.ts +2 -0
- package/src/room/RegionUrlProvider.ts +73 -0
- package/src/room/Room.ts +278 -177
- package/src/room/errors.ts +1 -0
- package/src/room/events.ts +24 -0
- package/src/room/participant/LocalParticipant.ts +30 -7
- package/src/room/participant/Participant.ts +27 -3
- package/src/room/participant/RemoteParticipant.ts +6 -3
- package/src/room/participant/publishUtils.test.ts +1 -1
- package/src/room/participant/publishUtils.ts +1 -1
- package/src/room/track/LocalAudioTrack.ts +14 -7
- package/src/room/track/LocalTrack.ts +23 -9
- package/src/room/track/LocalTrackPublication.ts +1 -1
- package/src/room/track/LocalVideoTrack.ts +15 -9
- package/src/room/track/RemoteAudioTrack.ts +1 -1
- package/src/room/track/RemoteTrackPublication.ts +4 -3
- package/src/room/track/RemoteVideoTrack.test.ts +1 -1
- package/src/room/track/RemoteVideoTrack.ts +8 -7
- package/src/room/track/Track.ts +46 -31
- package/src/room/track/create.ts +2 -2
- package/src/room/types.ts +17 -0
- package/src/room/utils.ts +53 -0
@@ -17,10 +17,12 @@ 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?;
|
23
24
|
private reliableDC?;
|
25
|
+
private dcBufferStatus;
|
24
26
|
private reliableDCSub?;
|
25
27
|
private subscriberPrimary;
|
26
28
|
private primaryPC?;
|
@@ -33,7 +35,6 @@ export default class RTCEngine extends RTCEngine_base {
|
|
33
35
|
private signalOpts?;
|
34
36
|
private reconnectAttempts;
|
35
37
|
private reconnectStart;
|
36
|
-
private fullReconnectOnNext;
|
37
38
|
private clientConfiguration?;
|
38
39
|
private attemptingReconnect;
|
39
40
|
private reconnectPolicy;
|
@@ -46,6 +47,7 @@ export default class RTCEngine extends RTCEngine_base {
|
|
46
47
|
private closingLock;
|
47
48
|
private dataProcessLock;
|
48
49
|
private shouldFailNext;
|
50
|
+
private regionUrlProvider?;
|
49
51
|
constructor(options: InternalRoomOptions);
|
50
52
|
join(url: string, token: string, opts: SignalOptions, abortSignal?: AbortSignal): Promise<JoinResponse>;
|
51
53
|
close(): Promise<void>;
|
@@ -66,6 +68,7 @@ export default class RTCEngine extends RTCEngine_base {
|
|
66
68
|
private handleDataChannel;
|
67
69
|
private handleDataMessage;
|
68
70
|
private handleDataError;
|
71
|
+
private handleBufferedAmountLow;
|
69
72
|
private setPreferredCodec;
|
70
73
|
createSender(track: LocalTrack, opts: TrackPublishOptions, encodings?: RTCRtpEncodingParameters[]): Promise<RTCRtpSender>;
|
71
74
|
createSimulcastSender(track: LocalVideoTrack, simulcastTrack: SimulcastTrackInfo, opts: TrackPublishOptions, encodings?: RTCRtpEncodingParameters[]): Promise<RTCRtpSender | undefined>;
|
@@ -77,8 +80,12 @@ export default class RTCEngine extends RTCEngine_base {
|
|
77
80
|
private getNextRetryDelay;
|
78
81
|
private restartConnection;
|
79
82
|
private resumeConnection;
|
80
|
-
|
83
|
+
waitForPCInitialConnection(timeout?: number, abortController?: AbortController): Promise<void>;
|
84
|
+
private waitForPCReconnected;
|
85
|
+
waitForRestarted: () => Promise<void>;
|
81
86
|
sendDataPacket(packet: DataPacket, kind: DataPacket_Kind): Promise<void>;
|
87
|
+
private updateAndEmitDCBufferStatus;
|
88
|
+
private isBufferStatusLow;
|
82
89
|
/**
|
83
90
|
* @internal
|
84
91
|
*/
|
@@ -100,13 +107,15 @@ export type EngineEventCallbacks = {
|
|
100
107
|
resuming: () => void;
|
101
108
|
resumed: () => void;
|
102
109
|
restarting: () => void;
|
103
|
-
restarted: (
|
110
|
+
restarted: () => void;
|
104
111
|
signalResumed: () => void;
|
112
|
+
signalRestarted: (joinResp: JoinResponse) => void;
|
105
113
|
closing: () => void;
|
106
114
|
mediaTrackAdded: (track: MediaStreamTrack, streams: MediaStream, receiver?: RTCRtpReceiver) => void;
|
107
115
|
activeSpeakersUpdate: (speakers: Array<SpeakerInfo>) => void;
|
108
116
|
dataPacketReceived: (userPacket: UserPacket, kind: DataPacket_Kind) => void;
|
109
117
|
transportsCreated: (publisher: PCTransport, subscriber: PCTransport) => void;
|
118
|
+
dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
|
110
119
|
};
|
111
120
|
export {};
|
112
121
|
//# sourceMappingURL=RTCEngine.d.ts.map
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare class RegionUrlProvider {
|
2
|
+
private serverUrl;
|
3
|
+
private token;
|
4
|
+
private regionSettings;
|
5
|
+
private lastUpdateAt;
|
6
|
+
private settingsCacheTime;
|
7
|
+
private attemptedRegions;
|
8
|
+
constructor(url: string, token: string);
|
9
|
+
isCloud(): boolean;
|
10
|
+
getNextBestRegionUrl(abortSignal?: AbortSignal): Promise<string | null>;
|
11
|
+
resetAttempts(): void;
|
12
|
+
private fetchRegionSettings;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=RegionUrlProvider.d.ts.map
|
@@ -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
|
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.
|
@@ -86,6 +92,9 @@ declare class Room extends Room_base {
|
|
86
92
|
*/
|
87
93
|
prepareConnection(url: string): Promise<void>;
|
88
94
|
connect: (url: string, token: string, opts?: RoomConnectOptions) => Promise<void>;
|
95
|
+
private connectSignal;
|
96
|
+
private applyJoinResponse;
|
97
|
+
private attemptConnection;
|
89
98
|
/**
|
90
99
|
* disconnects the room, emits [[RoomEvent.Disconnected]]
|
91
100
|
*/
|
@@ -97,14 +106,10 @@ declare class Room extends Room_base {
|
|
97
106
|
*/
|
98
107
|
getParticipantByIdentity(identity: string): Participant | undefined;
|
99
108
|
private clearConnectionFutures;
|
100
|
-
/**
|
101
|
-
* if the current room has a participant with `recorder: true` in its JWT grant
|
102
|
-
**/
|
103
|
-
get isRecording(): boolean;
|
104
109
|
/**
|
105
110
|
* @internal for testing
|
106
111
|
*/
|
107
|
-
simulateScenario(scenario:
|
112
|
+
simulateScenario(scenario: SimulationScenario): Promise<void>;
|
108
113
|
private onPageLeave;
|
109
114
|
/**
|
110
115
|
* Browsers have different policies regarding audio playback. Most requiring
|
@@ -141,7 +146,7 @@ declare class Room extends Room_base {
|
|
141
146
|
private recreateEngine;
|
142
147
|
private onTrackAdded;
|
143
148
|
private handleRestarting;
|
144
|
-
private
|
149
|
+
private handleSignalRestarted;
|
145
150
|
private handleDisconnect;
|
146
151
|
private handleParticipantUpdates;
|
147
152
|
private handleParticipantDisconnected;
|
@@ -167,6 +172,7 @@ declare class Room extends Room_base {
|
|
167
172
|
private setAndEmitConnectionState;
|
168
173
|
private emitWhenConnected;
|
169
174
|
private onLocalParticipantMetadataChanged;
|
175
|
+
private onLocalParticipantNameChanged;
|
170
176
|
private onLocalTrackMuted;
|
171
177
|
private onLocalTrackUnmuted;
|
172
178
|
private onLocalTrackPublished;
|
@@ -205,6 +211,7 @@ export type RoomEventCallbacks = {
|
|
205
211
|
localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
206
212
|
localAudioSilenceDetected: (publication: LocalTrackPublication) => void;
|
207
213
|
participantMetadataChanged: (metadata: string | undefined, participant: RemoteParticipant | LocalParticipant) => void;
|
214
|
+
participantNameChanged: (name: string, participant: RemoteParticipant | LocalParticipant) => void;
|
208
215
|
participantPermissionsChanged: (prevPermissions: ParticipantPermission | undefined, participant: RemoteParticipant | LocalParticipant) => void;
|
209
216
|
activeSpeakersChanged: (speakers: Array<Participant>) => void;
|
210
217
|
roomMetadataChanged: (metadata: string) => void;
|
@@ -217,5 +224,6 @@ export type RoomEventCallbacks = {
|
|
217
224
|
audioPlaybackChanged: (playing: boolean) => void;
|
218
225
|
signalConnected: () => void;
|
219
226
|
recordingStatusChanged: (recording: boolean) => void;
|
227
|
+
dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
|
220
228
|
};
|
221
229
|
//# sourceMappingURL=Room.d.ts.map
|
@@ -5,7 +5,8 @@ export declare class LivekitError extends Error {
|
|
5
5
|
export declare const enum ConnectionErrorReason {
|
6
6
|
NotAllowed = 0,
|
7
7
|
ServerUnreachable = 1,
|
8
|
-
InternalError = 2
|
8
|
+
InternalError = 2,
|
9
|
+
Cancelled = 3
|
9
10
|
}
|
10
11
|
export declare class ConnectionError extends LivekitError {
|
11
12
|
status?: number;
|
@@ -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.
|
@@ -231,7 +238,12 @@ export declare enum RoomEvent {
|
|
231
238
|
* Recording of a room has started/stopped. Room.isRecording will be updated too.
|
232
239
|
* args: (isRecording: boolean)
|
233
240
|
*/
|
234
|
-
RecordingStatusChanged = "recordingStatusChanged"
|
241
|
+
RecordingStatusChanged = "recordingStatusChanged",
|
242
|
+
/**
|
243
|
+
* Emits whenever the current buffer status of a data channel changes
|
244
|
+
* args: (isLow: boolean, kind: [[DataPacket_Kind]])
|
245
|
+
*/
|
246
|
+
DCBufferStatusChanged = "dcBufferStatusChanged"
|
235
247
|
}
|
236
248
|
export declare enum ParticipantEvent {
|
237
249
|
/**
|
@@ -310,6 +322,13 @@ export declare enum ParticipantEvent {
|
|
310
322
|
*
|
311
323
|
*/
|
312
324
|
ParticipantMetadataChanged = "participantMetadataChanged",
|
325
|
+
/**
|
326
|
+
* Participant's display name changed
|
327
|
+
*
|
328
|
+
* args: (name: string, [[Participant]])
|
329
|
+
*
|
330
|
+
*/
|
331
|
+
ParticipantNameChanged = "participantNameChanged",
|
313
332
|
/**
|
314
333
|
* Data received from this participant as sender.
|
315
334
|
* Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
|
@@ -375,10 +394,12 @@ export declare enum EngineEvent {
|
|
375
394
|
Restarting = "restarting",
|
376
395
|
Restarted = "restarted",
|
377
396
|
SignalResumed = "signalResumed",
|
397
|
+
SignalRestarted = "signalRestarted",
|
378
398
|
Closing = "closing",
|
379
399
|
MediaTrackAdded = "mediaTrackAdded",
|
380
400
|
ActiveSpeakersUpdate = "activeSpeakersUpdate",
|
381
|
-
DataPacketReceived = "dataPacketReceived"
|
401
|
+
DataPacketReceived = "dataPacketReceived",
|
402
|
+
DCBufferStatusChanged = "dcBufferStatusChanged"
|
382
403
|
}
|
383
404
|
export declare enum TrackEvent {
|
384
405
|
Message = "message",
|
@@ -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):
|
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 {
|
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):
|
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):
|
38
|
+
updateInfo(info: ParticipantInfo): boolean;
|
39
39
|
/** @internal */
|
40
40
|
unpublishTrack(sid: Track.SID, sendUnpublish?: boolean): void;
|
41
41
|
/**
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import type { VideoCodec } from './options';
|
1
|
+
import { Mutex } from '../utils';
|
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;
|
@@ -9,7 +9,8 @@ export default abstract class LocalTrack extends Track {
|
|
9
9
|
protected constraints: MediaTrackConstraints;
|
10
10
|
protected reacquireTrack: boolean;
|
11
11
|
protected providedByUser: boolean;
|
12
|
-
protected
|
12
|
+
protected muteLock: Mutex;
|
13
|
+
protected pauseUpstreamLock: Mutex;
|
13
14
|
/**
|
14
15
|
*
|
15
16
|
* @param mediaTrack
|
@@ -2,9 +2,9 @@ import type { TrackInfo } from '../../proto/livekit_models';
|
|
2
2
|
import type LocalAudioTrack from './LocalAudioTrack';
|
3
3
|
import type LocalTrack from './LocalTrack';
|
4
4
|
import type LocalVideoTrack from './LocalVideoTrack';
|
5
|
-
import type { TrackPublishOptions } from './options';
|
6
5
|
import type { Track } from './Track';
|
7
6
|
import { TrackPublication } from './TrackPublication';
|
7
|
+
import type { TrackPublishOptions } from './options';
|
8
8
|
export default class LocalTrackPublication extends TrackPublication {
|
9
9
|
track?: LocalTrack;
|
10
10
|
options?: TrackPublishOptions;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { AudioReceiverStats } from '../stats';
|
2
|
-
import type { AudioOutputOptions } from './options';
|
3
2
|
import RemoteTrack from './RemoteTrack';
|
3
|
+
import type { AudioOutputOptions } from './options';
|
4
4
|
export default class RemoteAudioTrack extends RemoteTrack {
|
5
5
|
private prevStats?;
|
6
6
|
private elementVolume;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { TrackInfo, VideoQuality } from '../../proto/livekit_models';
|
2
2
|
import type RemoteTrack from './RemoteTrack';
|
3
|
-
import
|
3
|
+
import { Track } from './Track';
|
4
4
|
import { TrackPublication } from './TrackPublication';
|
5
5
|
export default class RemoteTrackPublication extends TrackPublication {
|
6
6
|
track?: RemoteTrack;
|
@@ -6,7 +6,7 @@ export default class RemoteVideoTrack extends RemoteTrack {
|
|
6
6
|
private adaptiveStreamSettings?;
|
7
7
|
private lastVisible?;
|
8
8
|
private lastDimensions?;
|
9
|
-
private
|
9
|
+
private isObserved;
|
10
10
|
constructor(mediaTrack: MediaStreamTrack, sid: string, receiver?: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings);
|
11
11
|
get isAdaptiveStream(): boolean;
|
12
12
|
get mediaStreamTrack(): MediaStreamTrack;
|
@@ -58,10 +58,12 @@ export declare abstract class Track extends Track_base {
|
|
58
58
|
protected enable(): void;
|
59
59
|
protected disable(): void;
|
60
60
|
abstract startMonitor(signalClient?: SignalClient): void;
|
61
|
-
|
61
|
+
stopMonitor(): void;
|
62
62
|
private recycleElement;
|
63
63
|
protected appVisibilityChangedListener: () => void;
|
64
64
|
protected handleAppVisibilityChanged(): Promise<void>;
|
65
|
+
protected addAppVisibilityListener(): void;
|
66
|
+
protected removeAppVisibilityListener(): void;
|
65
67
|
}
|
66
68
|
/** @internal */
|
67
69
|
export declare function attachToElement(track: MediaStreamTrack, element: HTMLMediaElement): void;
|
@@ -18,4 +18,9 @@ export type DataPublishOptions = {
|
|
18
18
|
/** the topic under which the message gets published */
|
19
19
|
topic?: string;
|
20
20
|
};
|
21
|
+
export type LiveKitReactNativeInfo = {
|
22
|
+
platform: 'ios' | 'android' | 'windows' | 'macos' | 'web' | 'native';
|
23
|
+
devicePixelRatio: number;
|
24
|
+
};
|
25
|
+
export type SimulationScenario = 'signal-reconnect' | 'speaker' | 'node-failure' | 'server-leave' | 'migration' | 'resume-reconnect' | 'force-tcp' | 'force-tls' | 'full-reconnect';
|
21
26
|
//# sourceMappingURL=types.d.ts.map
|
@@ -17,6 +17,10 @@ export declare function isFireFox(): boolean;
|
|
17
17
|
export declare function isSafari(): boolean;
|
18
18
|
export declare function isMobile(): boolean;
|
19
19
|
export declare function isWeb(): boolean;
|
20
|
+
export declare function isReactNative(): boolean;
|
21
|
+
export declare function isCloud(serverUrl: URL): boolean;
|
22
|
+
export declare function getReactNativeOs(): string | undefined;
|
23
|
+
export declare function getDevicePixelRatio(): number;
|
20
24
|
export declare function compareVersions(v1: string, v2: string): number;
|
21
25
|
export declare const getResizeObserver: () => ResizeObserver;
|
22
26
|
export declare const getIntersectionObserver: () => IntersectionObserver;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "livekit-client",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.9.0",
|
4
4
|
"description": "JavaScript/TypeScript client SDK for LiveKit",
|
5
5
|
"main": "./dist/livekit-client.umd.js",
|
6
6
|
"unpkg": "./dist/livekit-client.umd.js",
|
@@ -51,40 +51,41 @@
|
|
51
51
|
"webrtc-adapter": "^8.1.1"
|
52
52
|
},
|
53
53
|
"devDependencies": {
|
54
|
-
"@babel/core": "7.21.
|
55
|
-
"@babel/preset-env": "7.
|
56
|
-
"@changesets/
|
57
|
-
"@changesets
|
54
|
+
"@babel/core": "7.21.4",
|
55
|
+
"@babel/preset-env": "7.21.4",
|
56
|
+
"@changesets/cli": "2.26.1",
|
57
|
+
"@livekit/changesets-changelog-github": "^0.0.4",
|
58
58
|
"@rollup/plugin-babel": "6.0.3",
|
59
|
-
"@rollup/plugin-commonjs": "24.0
|
59
|
+
"@rollup/plugin-commonjs": "24.1.0",
|
60
60
|
"@rollup/plugin-json": "6.0.0",
|
61
|
-
"@rollup/plugin-node-resolve": "15.0.
|
61
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
62
62
|
"@rollup/plugin-terser": "^0.4.0",
|
63
|
-
"@
|
64
|
-
"@types/
|
63
|
+
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
64
|
+
"@types/jest": "29.5.0",
|
65
|
+
"@types/sdp-transform": "2.4.6",
|
65
66
|
"@types/ua-parser-js": "0.7.36",
|
66
67
|
"@types/ws": "8.5.4",
|
67
|
-
"@typescript-eslint/eslint-plugin": "5.
|
68
|
-
"@typescript-eslint/parser": "5.
|
68
|
+
"@typescript-eslint/eslint-plugin": "5.58.0",
|
69
|
+
"@typescript-eslint/parser": "5.58.0",
|
69
70
|
"downlevel-dts": "^0.11.0",
|
70
|
-
"eslint": "8.
|
71
|
+
"eslint": "8.38.0",
|
71
72
|
"eslint-config-airbnb-typescript": "17.0.0",
|
72
|
-
"eslint-config-prettier": "8.
|
73
|
+
"eslint-config-prettier": "8.8.0",
|
73
74
|
"eslint-plugin-import": "2.27.5",
|
74
75
|
"gh-pages": "5.0.0",
|
75
|
-
"jest": "29.
|
76
|
-
"prettier": "2.8.
|
77
|
-
"rollup": "3.
|
76
|
+
"jest": "29.5.0",
|
77
|
+
"prettier": "^2.8.8",
|
78
|
+
"rollup": "3.20.2",
|
78
79
|
"rollup-plugin-delete": "^2.0.0",
|
79
80
|
"rollup-plugin-filesize": "10.0.0",
|
80
81
|
"rollup-plugin-re": "1.0.7",
|
81
82
|
"rollup-plugin-typescript2": "0.34.1",
|
82
|
-
"ts-jest": "29.0
|
83
|
-
"ts-proto": "1.
|
84
|
-
"typedoc": "0.
|
83
|
+
"ts-jest": "29.1.0",
|
84
|
+
"ts-proto": "1.146.0",
|
85
|
+
"typedoc": "0.24.1",
|
85
86
|
"typedoc-plugin-no-inherit": "1.4.0",
|
86
87
|
"typescript": "4.9.5",
|
87
|
-
"vite": "4.1
|
88
|
+
"vite": "4.2.1"
|
88
89
|
},
|
89
90
|
"browserslist": [
|
90
91
|
"safari >= 11",
|