livekit-client 2.13.0 → 2.13.1
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 +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +1 -0
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +90 -49
- 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/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +1 -1
- 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/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -1
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +3 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/room/Room.d.ts +1 -1
- package/dist/ts4.2/src/room/errors.d.ts +2 -1
- package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/utils.d.ts +3 -0
- package/package.json +11 -11
- package/src/room/RTCEngine.ts +5 -2
- package/src/room/Room.ts +9 -6
- package/src/room/errors.ts +1 -0
- package/src/room/participant/LocalParticipant.ts +36 -18
- package/src/room/participant/Participant.ts +1 -1
- package/src/room/participant/publishUtils.ts +4 -0
- package/src/room/track/LocalVideoTrack.ts +14 -5
- package/src/room/utils.ts +14 -1
@@ -12,7 +12,7 @@ import { ScalabilityMode } from '../participant/publishUtils';
|
|
12
12
|
import type { VideoSenderStats } from '../stats';
|
13
13
|
import { computeBitrate, monitorFrequency } from '../stats';
|
14
14
|
import type { LoggerOptions } from '../types';
|
15
|
-
import { compareVersions, isFireFox, isMobile, isWeb } from '../utils';
|
15
|
+
import { compareVersions, isFireFox, isMobile, isSVCCodec, isWeb } from '../utils';
|
16
16
|
import LocalTrack from './LocalTrack';
|
17
17
|
import { Track, VideoQuality } from './Track';
|
18
18
|
import type { VideoCaptureOptions, VideoCodec } from './options';
|
@@ -239,7 +239,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
|
|
239
239
|
);
|
240
240
|
}
|
241
241
|
this.log.debug(`setting publishing quality. max quality ${maxQuality}`, this.logContext);
|
242
|
-
this.setPublishingLayers(qualities);
|
242
|
+
this.setPublishingLayers(isSVCCodec(this.codec), qualities);
|
243
243
|
}
|
244
244
|
|
245
245
|
async restartTrack(options?: VideoCaptureOptions) {
|
@@ -334,7 +334,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
|
|
334
334
|
});
|
335
335
|
// only enable simulcast codec for preference codec setted
|
336
336
|
if (!this.codec && codecs.length > 0) {
|
337
|
-
await this.setPublishingLayers(codecs[0].qualities);
|
337
|
+
await this.setPublishingLayers(isSVCCodec(codecs[0].codec), codecs[0].qualities);
|
338
338
|
return [];
|
339
339
|
}
|
340
340
|
|
@@ -343,7 +343,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
|
|
343
343
|
const newCodecs: VideoCodec[] = [];
|
344
344
|
for await (const codec of codecs) {
|
345
345
|
if (!this.codec || this.codec === codec.codec) {
|
346
|
-
await this.setPublishingLayers(codec.qualities);
|
346
|
+
await this.setPublishingLayers(isSVCCodec(codec.codec), codec.qualities);
|
347
347
|
} else {
|
348
348
|
const simulcastCodecInfo = this.simulcastCodecs.get(codec.codec as VideoCodec);
|
349
349
|
this.log.debug(`try setPublishingCodec for ${codec.codec}`, {
|
@@ -364,6 +364,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
|
|
364
364
|
simulcastCodecInfo.encodings!,
|
365
365
|
codec.qualities,
|
366
366
|
this.senderLock,
|
367
|
+
isSVCCodec(codec.codec),
|
367
368
|
this.log,
|
368
369
|
this.logContext,
|
369
370
|
);
|
@@ -377,7 +378,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
|
|
377
378
|
* @internal
|
378
379
|
* Sets layers that should be publishing
|
379
380
|
*/
|
380
|
-
async setPublishingLayers(qualities: SubscribedQuality[]) {
|
381
|
+
async setPublishingLayers(isSvc: boolean, qualities: SubscribedQuality[]) {
|
381
382
|
this.log.debug('setting publishing layers', { ...this.logContext, qualities });
|
382
383
|
if (!this.sender || !this.encodings) {
|
383
384
|
return;
|
@@ -388,6 +389,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
|
|
388
389
|
this.encodings,
|
389
390
|
qualities,
|
390
391
|
this.senderLock,
|
392
|
+
isSvc,
|
391
393
|
this.log,
|
392
394
|
this.logContext,
|
393
395
|
);
|
@@ -434,6 +436,7 @@ async function setPublishingLayersForSender(
|
|
434
436
|
senderEncodings: RTCRtpEncodingParameters[],
|
435
437
|
qualities: SubscribedQuality[],
|
436
438
|
senderLock: Mutex,
|
439
|
+
isSVC: boolean,
|
437
440
|
log: StructuredLogger,
|
438
441
|
logContext: Record<string, unknown>,
|
439
442
|
) {
|
@@ -498,6 +501,12 @@ async function setPublishingLayersForSender(
|
|
498
501
|
}
|
499
502
|
}
|
500
503
|
} else {
|
504
|
+
if (isSVC) {
|
505
|
+
const hasEnabledEncoding = qualities.some((q) => q.enabled);
|
506
|
+
if (hasEnabledEncoding) {
|
507
|
+
qualities.forEach((q) => (q.enabled = true));
|
508
|
+
}
|
509
|
+
}
|
501
510
|
// simulcast dynacast encodings
|
502
511
|
encodings.forEach((encoding, idx) => {
|
503
512
|
let rid = encoding.rid ?? '';
|
package/src/room/utils.ts
CHANGED
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
DisconnectReason,
|
6
6
|
Transcription as TranscriptionModel,
|
7
7
|
} from '@livekit/protocol';
|
8
|
-
import { getBrowser } from '../utils/browserParser';
|
8
|
+
import { type BrowserDetails, getBrowser } from '../utils/browserParser';
|
9
9
|
import { protocolVersion, version } from '../version';
|
10
10
|
import { type ConnectionError, ConnectionErrorReason } from './errors';
|
11
11
|
import type LocalParticipant from './participant/LocalParticipant';
|
@@ -143,11 +143,24 @@ export function isSafari(): boolean {
|
|
143
143
|
return getBrowser()?.name === 'Safari';
|
144
144
|
}
|
145
145
|
|
146
|
+
export function isSafariBased(): boolean {
|
147
|
+
const b = getBrowser();
|
148
|
+
return b?.name === 'Safari' || b?.os === 'iOS';
|
149
|
+
}
|
150
|
+
|
146
151
|
export function isSafari17(): boolean {
|
147
152
|
const b = getBrowser();
|
148
153
|
return b?.name === 'Safari' && b.version.startsWith('17.');
|
149
154
|
}
|
150
155
|
|
156
|
+
export function isSafariSvcApi(browser?: BrowserDetails): boolean {
|
157
|
+
if (!browser) {
|
158
|
+
browser = getBrowser();
|
159
|
+
}
|
160
|
+
// Safari 18.4 requires legacy svc api and scaleResolutionDown to be set
|
161
|
+
return browser?.name === 'Safari' && compareVersions(browser.version, '18.3') > 0;
|
162
|
+
}
|
163
|
+
|
151
164
|
export function isMobile(): boolean {
|
152
165
|
if (!isWeb()) return false;
|
153
166
|
|