livekit-client 2.0.3 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- 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 +11 -8
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +166 -77
- 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 +1 -1
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +2 -0
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts +1 -0
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +4 -2
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/room/DeviceManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +4 -2
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +2 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -2
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +4 -0
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +3 -1
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +10 -0
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/types.d.ts +4 -0
- package/dist/src/room/track/types.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +1 -1
- package/dist/ts4.2/src/e2ee/types.d.ts +2 -0
- package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +1 -0
- package/dist/ts4.2/src/index.d.ts +2 -2
- package/dist/ts4.2/src/logger.d.ts +4 -2
- package/dist/ts4.2/src/room/RTCEngine.d.ts +4 -2
- package/dist/ts4.2/src/room/events.d.ts +2 -1
- package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -2
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +4 -0
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +3 -1
- package/dist/ts4.2/src/room/track/options.d.ts +10 -0
- package/dist/ts4.2/src/room/track/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/api/SignalClient.ts +10 -5
- package/src/e2ee/E2eeManager.ts +2 -1
- package/src/e2ee/types.ts +2 -0
- package/src/e2ee/worker/FrameCryptor.ts +12 -6
- package/src/e2ee/worker/e2ee.worker.ts +1 -0
- package/src/index.ts +2 -1
- package/src/logger.ts +23 -18
- package/src/room/DeviceManager.ts +10 -1
- package/src/room/RTCEngine.ts +26 -8
- package/src/room/Room.ts +26 -2
- package/src/room/events.ts +1 -0
- package/src/room/participant/LocalParticipant.ts +4 -4
- package/src/room/participant/Participant.ts +0 -2
- package/src/room/participant/RemoteParticipant.ts +8 -0
- package/src/room/track/LocalAudioTrack.ts +10 -0
- package/src/room/track/LocalTrack.ts +20 -3
- package/src/room/track/LocalVideoTrack.ts +15 -1
- package/src/room/track/options.ts +41 -8
- package/src/room/track/types.ts +5 -0
- package/src/room/track/utils.ts +18 -11
- package/src/room/utils.ts +3 -0
@@ -257,6 +257,15 @@ export interface VideoEncoding {
|
|
257
257
|
priority?: RTCPriorityType;
|
258
258
|
}
|
259
259
|
|
260
|
+
export interface VideoPresetOptions {
|
261
|
+
width: number;
|
262
|
+
height: number;
|
263
|
+
aspectRatio?: number;
|
264
|
+
maxBitrate: number;
|
265
|
+
maxFramerate?: number;
|
266
|
+
priority?: RTCPriorityType;
|
267
|
+
}
|
268
|
+
|
260
269
|
export class VideoPreset {
|
261
270
|
encoding: VideoEncoding;
|
262
271
|
|
@@ -264,20 +273,44 @@ export class VideoPreset {
|
|
264
273
|
|
265
274
|
height: number;
|
266
275
|
|
276
|
+
aspectRatio?: number;
|
277
|
+
|
278
|
+
constructor(videoPresetOptions: VideoPresetOptions);
|
267
279
|
constructor(
|
268
280
|
width: number,
|
269
281
|
height: number,
|
270
282
|
maxBitrate: number,
|
271
283
|
maxFramerate?: number,
|
272
284
|
priority?: RTCPriorityType,
|
285
|
+
);
|
286
|
+
constructor(
|
287
|
+
widthOrOptions: number | VideoPresetOptions,
|
288
|
+
height?: number,
|
289
|
+
maxBitrate?: number,
|
290
|
+
maxFramerate?: number,
|
291
|
+
priority?: RTCPriorityType,
|
273
292
|
) {
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
293
|
+
if (typeof widthOrOptions === 'object') {
|
294
|
+
this.width = widthOrOptions.width;
|
295
|
+
this.height = widthOrOptions.height;
|
296
|
+
this.aspectRatio = widthOrOptions.aspectRatio;
|
297
|
+
this.encoding = {
|
298
|
+
maxBitrate: widthOrOptions.maxBitrate,
|
299
|
+
maxFramerate: widthOrOptions.maxFramerate,
|
300
|
+
priority: widthOrOptions.priority,
|
301
|
+
};
|
302
|
+
} else if (height !== undefined && maxBitrate !== undefined) {
|
303
|
+
this.width = widthOrOptions;
|
304
|
+
this.height = height;
|
305
|
+
this.aspectRatio = widthOrOptions / height;
|
306
|
+
this.encoding = {
|
307
|
+
maxBitrate,
|
308
|
+
maxFramerate,
|
309
|
+
priority,
|
310
|
+
};
|
311
|
+
} else {
|
312
|
+
throw new TypeError('Unsupported options: provide at least width, height and maxBitrate');
|
313
|
+
}
|
281
314
|
}
|
282
315
|
|
283
316
|
get resolution(): VideoResolution {
|
@@ -285,7 +318,7 @@ export class VideoPreset {
|
|
285
318
|
width: this.width,
|
286
319
|
height: this.height,
|
287
320
|
frameRate: this.encoding.maxFramerate,
|
288
|
-
aspectRatio: this.
|
321
|
+
aspectRatio: this.aspectRatio,
|
289
322
|
};
|
290
323
|
}
|
291
324
|
}
|
package/src/room/track/types.ts
CHANGED
package/src/room/track/utils.ts
CHANGED
@@ -214,20 +214,27 @@ export function getTrackPublicationInfo<T extends TrackPublication>(
|
|
214
214
|
export function getLogContextFromTrack(track: Track | TrackPublication): Record<string, unknown> {
|
215
215
|
if (track instanceof Track) {
|
216
216
|
return {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
217
|
+
trackID: track.sid,
|
218
|
+
source: track.source,
|
219
|
+
muted: track.isMuted,
|
220
|
+
enabled: track.mediaStreamTrack.enabled,
|
221
|
+
kind: track.kind,
|
222
|
+
streamID: track.mediaStreamID,
|
223
|
+
streamTrackID: track.mediaStreamTrack.id,
|
222
224
|
};
|
223
225
|
} else {
|
224
226
|
return {
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
227
|
+
trackID: track.trackSid,
|
228
|
+
enabled: track.isEnabled,
|
229
|
+
muted: track.isMuted,
|
230
|
+
trackInfo: {
|
231
|
+
mimeType: track.mimeType,
|
232
|
+
name: track.trackName,
|
233
|
+
encrypted: track.isEncrypted,
|
234
|
+
kind: track.kind,
|
235
|
+
source: track.source,
|
236
|
+
...(track.track ? getLogContextFromTrack(track.track) : {}),
|
237
|
+
},
|
231
238
|
};
|
232
239
|
}
|
233
240
|
}
|
package/src/room/utils.ts
CHANGED
@@ -133,6 +133,9 @@ export function supportsSetCodecPreferences(transceiver: RTCRtpTransceiver): boo
|
|
133
133
|
}
|
134
134
|
|
135
135
|
export function isBrowserSupported() {
|
136
|
+
if (typeof RTCPeerConnection === 'undefined') {
|
137
|
+
return false;
|
138
|
+
}
|
136
139
|
return supportsTransceiver() || supportsAddTrack();
|
137
140
|
}
|
138
141
|
|