livekit-client 2.13.5 → 2.13.7
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/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +82 -74
- 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 +5 -5
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/publishVideo.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +3 -2
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts +3 -3
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +4 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +5 -5
- package/dist/ts4.2/src/room/PCTransport.d.ts +3 -2
- package/dist/ts4.2/src/room/PCTransportManager.d.ts +3 -3
- package/dist/ts4.2/src/room/RTCEngine.d.ts +4 -0
- package/package.json +8 -8
- package/src/api/SignalClient.ts +13 -14
- package/src/connectionHelper/checks/publishVideo.ts +1 -0
- package/src/room/PCTransport.ts +30 -4
- package/src/room/PCTransportManager.ts +10 -7
- package/src/room/RTCEngine.ts +15 -7
- package/src/room/Room.ts +9 -9
- package/src/room/track/LocalVideoTrack.ts +14 -15
package/src/room/Room.ts
CHANGED
@@ -1301,10 +1301,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1301
1301
|
*/
|
1302
1302
|
async switchActiveDevice(kind: MediaDeviceKind, deviceId: string, exact: boolean = true) {
|
1303
1303
|
let success = true;
|
1304
|
-
let
|
1304
|
+
let shouldTriggerImmediateDeviceChange = false;
|
1305
1305
|
const deviceConstraint = exact ? { exact: deviceId } : deviceId;
|
1306
1306
|
if (kind === 'audioinput') {
|
1307
|
-
|
1307
|
+
shouldTriggerImmediateDeviceChange = this.localParticipant.audioTrackPublications.size === 0;
|
1308
1308
|
const prevDeviceId =
|
1309
1309
|
this.getActiveDevice(kind) ?? this.options.audioCaptureDefaults!.deviceId;
|
1310
1310
|
this.options.audioCaptureDefaults!.deviceId = deviceConstraint;
|
@@ -1319,8 +1319,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1319
1319
|
this.options.audioCaptureDefaults!.deviceId = prevDeviceId;
|
1320
1320
|
throw e;
|
1321
1321
|
}
|
1322
|
+
const isMuted = tracks.some((t) => t.track?.isMuted ?? false);
|
1323
|
+
if (success && isMuted) shouldTriggerImmediateDeviceChange = true;
|
1322
1324
|
} else if (kind === 'videoinput') {
|
1323
|
-
|
1325
|
+
shouldTriggerImmediateDeviceChange = this.localParticipant.videoTrackPublications.size === 0;
|
1324
1326
|
const prevDeviceId =
|
1325
1327
|
this.getActiveDevice(kind) ?? this.options.videoCaptureDefaults!.deviceId;
|
1326
1328
|
this.options.videoCaptureDefaults!.deviceId = deviceConstraint;
|
@@ -1336,6 +1338,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1336
1338
|
throw e;
|
1337
1339
|
}
|
1338
1340
|
} else if (kind === 'audiooutput') {
|
1341
|
+
shouldTriggerImmediateDeviceChange = true;
|
1339
1342
|
if (
|
1340
1343
|
(!supportsSetSinkId() && !this.options.webAudioMix) ||
|
1341
1344
|
(this.options.webAudioMix && this.audioContext && !('setSinkId' in this.audioContext))
|
@@ -1367,12 +1370,9 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1367
1370
|
throw e;
|
1368
1371
|
}
|
1369
1372
|
}
|
1370
|
-
|
1371
|
-
|
1372
|
-
this.localParticipant.activeDeviceMap.set(
|
1373
|
-
kind,
|
1374
|
-
(kind === 'audiooutput' && this.options.audioOutput?.deviceId) || deviceId,
|
1375
|
-
);
|
1373
|
+
|
1374
|
+
if (shouldTriggerImmediateDeviceChange) {
|
1375
|
+
this.localParticipant.activeDeviceMap.set(kind, deviceId);
|
1376
1376
|
this.emit(RoomEvent.ActiveDeviceChanged, kind, deviceId);
|
1377
1377
|
}
|
1378
1378
|
|
@@ -7,12 +7,11 @@ import {
|
|
7
7
|
} from '@livekit/protocol';
|
8
8
|
import type { SignalClient } from '../../api/SignalClient';
|
9
9
|
import type { StructuredLogger } from '../../logger';
|
10
|
-
import { getBrowser } from '../../utils/browserParser';
|
11
10
|
import { ScalabilityMode } from '../participant/publishUtils';
|
12
11
|
import type { VideoSenderStats } from '../stats';
|
13
12
|
import { computeBitrate, monitorFrequency } from '../stats';
|
14
13
|
import type { LoggerOptions } from '../types';
|
15
|
-
import {
|
14
|
+
import { isFireFox, isMobile, isSVCCodec, isWeb } from '../utils';
|
16
15
|
import LocalTrack from './LocalTrack';
|
17
16
|
import { Track, VideoQuality } from './Track';
|
18
17
|
import type { VideoCaptureOptions, VideoCodec } from './options';
|
@@ -459,15 +458,18 @@ async function setPublishingLayersForSender(
|
|
459
458
|
}
|
460
459
|
|
461
460
|
let hasChanged = false;
|
462
|
-
|
463
|
-
|
464
|
-
|
461
|
+
|
462
|
+
/* disable closable spatial layer as it has video blur / frozen issue with current server / client
|
463
|
+
1. chrome 113: when switching to up layer with scalability Mode change, it will generate a
|
464
|
+
low resolution frame and recover very quickly, but noticable
|
465
|
+
2. livekit sfu: additional pli request cause video frozen for a few frames, also noticable */
|
466
|
+
const closableSpatial = false;
|
465
467
|
/* @ts-ignore */
|
466
468
|
if (closableSpatial && encodings[0].scalabilityMode) {
|
467
469
|
// svc dynacast encodings
|
468
470
|
const encoding = encodings[0];
|
469
471
|
/* @ts-ignore */
|
470
|
-
const mode = new ScalabilityMode(encoding.scalabilityMode);
|
472
|
+
// const mode = new ScalabilityMode(encoding.scalabilityMode);
|
471
473
|
let maxQuality = ProtoVideoQuality.OFF;
|
472
474
|
qualities.forEach((q) => {
|
473
475
|
if (q.enabled && (maxQuality === ProtoVideoQuality.OFF || q.quality > maxQuality)) {
|
@@ -480,25 +482,22 @@ async function setPublishingLayersForSender(
|
|
480
482
|
encoding.active = false;
|
481
483
|
hasChanged = true;
|
482
484
|
}
|
483
|
-
} else if (!encoding.active || mode.spatial !== maxQuality + 1) {
|
485
|
+
} else if (!encoding.active /* || mode.spatial !== maxQuality + 1*/) {
|
484
486
|
hasChanged = true;
|
485
487
|
encoding.active = true;
|
486
|
-
/*
|
487
|
-
|
488
|
+
/*
|
489
|
+
@ts-ignore
|
490
|
+
const originalMode = new ScalabilityMode(senderEncodings[0].scalabilityMode)
|
488
491
|
mode.spatial = maxQuality + 1;
|
489
492
|
mode.suffix = originalMode.suffix;
|
490
493
|
if (mode.spatial === 1) {
|
491
494
|
// no suffix for L1Tx
|
492
495
|
mode.suffix = undefined;
|
493
496
|
}
|
494
|
-
|
497
|
+
@ts-ignore
|
495
498
|
encoding.scalabilityMode = mode.toString();
|
496
499
|
encoding.scaleResolutionDownBy = 2 ** (2 - maxQuality);
|
497
|
-
|
498
|
-
encoding.maxBitrate =
|
499
|
-
senderEncodings[0].maxBitrate /
|
500
|
-
(encoding.scaleResolutionDownBy * encoding.scaleResolutionDownBy);
|
501
|
-
}
|
500
|
+
*/
|
502
501
|
}
|
503
502
|
} else {
|
504
503
|
if (isSVC) {
|