livekit-client 2.7.2 → 2.7.4
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.esm.mjs +50 -19
- 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/e2ee/E2eeManager.d.ts +10 -3
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +6 -1
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/Room.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/RemoteParticipant.d.ts +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +10 -3
- package/dist/ts4.2/src/e2ee/types.d.ts +6 -1
- package/dist/ts4.2/src/index.d.ts +1 -0
- package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +1 -1
- package/package.json +1 -1
- package/src/e2ee/E2eeManager.ts +14 -3
- package/src/e2ee/types.ts +8 -1
- package/src/index.ts +1 -0
- package/src/room/PCTransport.ts +16 -0
- package/src/room/Room.ts +27 -11
- package/src/room/participant/LocalParticipant.test.ts +4 -0
- package/src/room/participant/LocalParticipant.ts +14 -4
- package/src/room/participant/Participant.ts +2 -1
- package/src/room/participant/RemoteParticipant.ts +3 -1
- package/src/room/track/utils.ts +2 -2
@@ -11119,7 +11119,7 @@ function getOSVersion(ua) {
|
|
11119
11119
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
11120
11120
|
}
|
11121
11121
|
|
11122
|
-
var version$1 = "2.7.
|
11122
|
+
var version$1 = "2.7.4";
|
11123
11123
|
|
11124
11124
|
const version = version$1;
|
11125
11125
|
const protocolVersion = 15;
|
@@ -11857,11 +11857,15 @@ function extractProcessorsFromOptions(options) {
|
|
11857
11857
|
let videoProcessor;
|
11858
11858
|
if (typeof newOptions.audio === 'object' && newOptions.audio.processor) {
|
11859
11859
|
audioProcessor = newOptions.audio.processor;
|
11860
|
-
newOptions.audio
|
11860
|
+
newOptions.audio = Object.assign(Object.assign({}, newOptions.audio), {
|
11861
|
+
processor: undefined
|
11862
|
+
});
|
11861
11863
|
}
|
11862
11864
|
if (typeof newOptions.video === 'object' && newOptions.video.processor) {
|
11863
11865
|
videoProcessor = newOptions.video.processor;
|
11864
|
-
newOptions.video
|
11866
|
+
newOptions.video = Object.assign(Object.assign({}, newOptions.video), {
|
11867
|
+
processor: undefined
|
11868
|
+
});
|
11865
11869
|
}
|
11866
11870
|
return {
|
11867
11871
|
audioProcessor,
|
@@ -14866,6 +14870,7 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
14866
14870
|
}, this.logContext));
|
14867
14871
|
const sdpParsed = libExports.parse((_a = offer.sdp) !== null && _a !== void 0 ? _a : '');
|
14868
14872
|
sdpParsed.media.forEach(media => {
|
14873
|
+
ensureIPAddrMatchVersion(media);
|
14869
14874
|
if (media.type === 'audio') {
|
14870
14875
|
ensureAudioNackAndStereo(media, [], []);
|
14871
14876
|
} else if (media.type === 'video') {
|
@@ -14918,6 +14923,7 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
14918
14923
|
const answer = yield this.pc.createAnswer();
|
14919
14924
|
const sdpParsed = libExports.parse((_a = answer.sdp) !== null && _a !== void 0 ? _a : '');
|
14920
14925
|
sdpParsed.media.forEach(media => {
|
14926
|
+
ensureIPAddrMatchVersion(media);
|
14921
14927
|
if (media.type === 'audio') {
|
14922
14928
|
ensureAudioNackAndStereo(media, this.remoteStereoMids, this.remoteNackMids);
|
14923
14929
|
}
|
@@ -15172,6 +15178,19 @@ function extractStereoAndNackAudioFromOffer(offer) {
|
|
15172
15178
|
nackMids
|
15173
15179
|
};
|
15174
15180
|
}
|
15181
|
+
function ensureIPAddrMatchVersion(media) {
|
15182
|
+
// Chrome could generate sdp with c = IN IP4 <ipv6 addr>
|
15183
|
+
// in edge case and return error when set sdp.This is not a
|
15184
|
+
// sdk error but correct it if the issue detected.
|
15185
|
+
if (media.connection) {
|
15186
|
+
const isV6 = media.connection.ip.indexOf(':') >= 0;
|
15187
|
+
if (media.connection.version === 4 && isV6 || media.connection.version === 6 && !isV6) {
|
15188
|
+
// fallback to dummy address
|
15189
|
+
media.connection.ip = '0.0.0.0';
|
15190
|
+
media.connection.version = 4;
|
15191
|
+
}
|
15192
|
+
}
|
15193
|
+
}
|
15175
15194
|
|
15176
15195
|
const defaultVideoCodec = 'vp8';
|
15177
15196
|
const publishDefaults = {
|
@@ -18879,8 +18898,8 @@ class Participant extends eventsExports.EventEmitter {
|
|
18879
18898
|
return Object.freeze(Object.assign({}, this._attributes));
|
18880
18899
|
}
|
18881
18900
|
/** @internal */
|
18882
|
-
constructor(sid, identity, name, metadata, loggerOptions) {
|
18883
|
-
let kind = arguments.length >
|
18901
|
+
constructor(sid, identity, name, metadata, attributes, loggerOptions) {
|
18902
|
+
let kind = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ParticipantInfo_Kind.STANDARD;
|
18884
18903
|
var _a;
|
18885
18904
|
super();
|
18886
18905
|
/** audio level between 0-1.0, 1 being loudest, 0 being softest */
|
@@ -18900,7 +18919,7 @@ class Participant extends eventsExports.EventEmitter {
|
|
18900
18919
|
this.videoTrackPublications = new Map();
|
18901
18920
|
this.trackPublications = new Map();
|
18902
18921
|
this._kind = kind;
|
18903
|
-
this._attributes = {};
|
18922
|
+
this._attributes = attributes !== null && attributes !== void 0 ? attributes : {};
|
18904
18923
|
}
|
18905
18924
|
getTrackPublications() {
|
18906
18925
|
return Array.from(this.trackPublications.values());
|
@@ -19087,7 +19106,7 @@ function trackPermissionToProto(perms) {
|
|
19087
19106
|
class LocalParticipant extends Participant {
|
19088
19107
|
/** @internal */
|
19089
19108
|
constructor(sid, identity, engine, options) {
|
19090
|
-
super(sid, identity, undefined, undefined, {
|
19109
|
+
super(sid, identity, undefined, undefined, undefined, {
|
19091
19110
|
loggerName: options.loggerName,
|
19092
19111
|
loggerContextCb: () => this.engine.logContext
|
19093
19112
|
});
|
@@ -19490,7 +19509,7 @@ class LocalParticipant extends Participant {
|
|
19490
19509
|
if (this.pendingPublishing.has(source)) {
|
19491
19510
|
const pendingTrack = yield this.waitForPendingPublicationOfSource(source);
|
19492
19511
|
if (!pendingTrack) {
|
19493
|
-
this.log.info('
|
19512
|
+
this.log.info('waiting for pending publication promise timed out', Object.assign(Object.assign({}, this.logContext), {
|
19494
19513
|
source
|
19495
19514
|
}));
|
19496
19515
|
}
|
@@ -19538,9 +19557,14 @@ class LocalParticipant extends Participant {
|
|
19538
19557
|
}
|
19539
19558
|
}
|
19540
19559
|
} else {
|
19541
|
-
if (!(track === null || track === void 0 ? void 0 : track.track)) {
|
19560
|
+
if (!(track === null || track === void 0 ? void 0 : track.track) && this.pendingPublishing.has(source)) {
|
19542
19561
|
// if there's no track available yet first wait for pending publishing promises of that source to see if it becomes available
|
19543
19562
|
track = yield this.waitForPendingPublicationOfSource(source);
|
19563
|
+
if (!track) {
|
19564
|
+
this.log.info('waiting for pending publication promise timed out', Object.assign(Object.assign({}, this.logContext), {
|
19565
|
+
source
|
19566
|
+
}));
|
19567
|
+
}
|
19544
19568
|
}
|
19545
19569
|
if (track && track.track) {
|
19546
19570
|
// screenshare cannot be muted, unpublish instead
|
@@ -20138,6 +20162,8 @@ class LocalParticipant extends Participant {
|
|
20138
20162
|
}
|
20139
20163
|
if (stopOnUnpublish) {
|
20140
20164
|
track.stop();
|
20165
|
+
} else {
|
20166
|
+
track.stopMonitor();
|
20141
20167
|
}
|
20142
20168
|
let negotiationNeeded = false;
|
20143
20169
|
const trackSender = track.sender;
|
@@ -20660,7 +20686,6 @@ class LocalParticipant extends Participant {
|
|
20660
20686
|
}
|
20661
20687
|
yield sleep(20);
|
20662
20688
|
}
|
20663
|
-
throw new Error('waiting for pending publication promise timed out');
|
20664
20689
|
});
|
20665
20690
|
}
|
20666
20691
|
}
|
@@ -20904,7 +20929,7 @@ class RemoteTrackPublication extends TrackPublication {
|
|
20904
20929
|
class RemoteParticipant extends Participant {
|
20905
20930
|
/** @internal */
|
20906
20931
|
static fromParticipantInfo(signalClient, pi, loggerOptions) {
|
20907
|
-
return new RemoteParticipant(signalClient, pi.sid, pi.identity, pi.name, pi.metadata, loggerOptions, pi.kind);
|
20932
|
+
return new RemoteParticipant(signalClient, pi.sid, pi.identity, pi.name, pi.metadata, pi.attributes, loggerOptions, pi.kind);
|
20908
20933
|
}
|
20909
20934
|
get logContext() {
|
20910
20935
|
return Object.assign(Object.assign({}, super.logContext), {
|
@@ -20913,9 +20938,9 @@ class RemoteParticipant extends Participant {
|
|
20913
20938
|
});
|
20914
20939
|
}
|
20915
20940
|
/** @internal */
|
20916
|
-
constructor(signalClient, sid, identity, name, metadata, loggerOptions) {
|
20917
|
-
let kind = arguments.length >
|
20918
|
-
super(sid, identity || '', name, metadata, loggerOptions, kind);
|
20941
|
+
constructor(signalClient, sid, identity, name, metadata, attributes, loggerOptions) {
|
20942
|
+
let kind = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ParticipantInfo_Kind.STANDARD;
|
20943
|
+
super(sid, identity || '', name, metadata, attributes, loggerOptions, kind);
|
20919
20944
|
this.signalClient = signalClient;
|
20920
20945
|
this.trackPublications = new Map();
|
20921
20946
|
this.audioTrackPublications = new Map();
|
@@ -21947,7 +21972,11 @@ class Room extends eventsExports.EventEmitter {
|
|
21947
21972
|
setupE2EE() {
|
21948
21973
|
var _a;
|
21949
21974
|
if (this.options.e2ee) {
|
21950
|
-
|
21975
|
+
if ('e2eeManager' in this.options.e2ee) {
|
21976
|
+
this.e2eeManager = this.options.e2ee.e2eeManager;
|
21977
|
+
} else {
|
21978
|
+
this.e2eeManager = new E2EEManager(this.options.e2ee);
|
21979
|
+
}
|
21951
21980
|
this.e2eeManager.on(EncryptionEvent.ParticipantEncryptionStatusChanged, (enabled, participant) => {
|
21952
21981
|
if (participant instanceof LocalParticipant) {
|
21953
21982
|
this.isE2EEEnabled = enabled;
|
@@ -22448,13 +22477,15 @@ class Room extends eventsExports.EventEmitter {
|
|
22448
22477
|
});
|
22449
22478
|
});
|
22450
22479
|
this.localParticipant.trackPublications.forEach(pub => {
|
22451
|
-
var _a, _b;
|
22480
|
+
var _a, _b, _c;
|
22452
22481
|
if (pub.track) {
|
22453
22482
|
this.localParticipant.unpublishTrack(pub.track, shouldStopTracks);
|
22454
22483
|
}
|
22455
22484
|
if (shouldStopTracks) {
|
22456
22485
|
(_a = pub.track) === null || _a === void 0 ? void 0 : _a.detach();
|
22457
22486
|
(_b = pub.track) === null || _b === void 0 ? void 0 : _b.stop();
|
22487
|
+
} else {
|
22488
|
+
(_c = pub.track) === null || _c === void 0 ? void 0 : _c.stopMonitor();
|
22458
22489
|
}
|
22459
22490
|
});
|
22460
22491
|
this.localParticipant.off(ParticipantEvent.ParticipantMetadataChanged, this.onLocalParticipantMetadataChanged).off(ParticipantEvent.ParticipantNameChanged, this.onLocalParticipantNameChanged).off(ParticipantEvent.AttributesChanged, this.onLocalAttributesChanged).off(ParticipantEvent.TrackMuted, this.onLocalTrackMuted).off(ParticipantEvent.TrackUnmuted, this.onLocalTrackUnmuted).off(ParticipantEvent.LocalTrackPublished, this.onLocalTrackPublished).off(ParticipantEvent.LocalTrackUnpublished, this.onLocalTrackUnpublished).off(ParticipantEvent.ConnectionQualityChanged, this.onLocalConnectionQualityChanged).off(ParticipantEvent.MediaDevicesError, this.onMediaDevicesError).off(ParticipantEvent.AudioStreamAcquired, this.startAudio).off(ParticipantEvent.ChatMessage, this.onLocalChatMessageSent).off(ParticipantEvent.ParticipantPermissionsChanged, this.onLocalParticipantPermissionsChanged);
|
@@ -22534,7 +22565,7 @@ class Room extends eventsExports.EventEmitter {
|
|
22534
22565
|
loggerName: this.options.loggerName
|
22535
22566
|
});
|
22536
22567
|
} else {
|
22537
|
-
participant = new RemoteParticipant(this.engine.client, '', identity, undefined, undefined, {
|
22568
|
+
participant = new RemoteParticipant(this.engine.client, '', identity, undefined, undefined, undefined, {
|
22538
22569
|
loggerContextCb: () => this.logContext,
|
22539
22570
|
loggerName: this.options.loggerName
|
22540
22571
|
});
|
@@ -22653,10 +22684,10 @@ class Room extends eventsExports.EventEmitter {
|
|
22653
22684
|
consecutiveFailures++;
|
22654
22685
|
this.log.warn('detected connection state mismatch', Object.assign(Object.assign({}, this.logContext), {
|
22655
22686
|
numFailures: consecutiveFailures,
|
22656
|
-
engine: {
|
22687
|
+
engine: this.engine ? {
|
22657
22688
|
closed: this.engine.isClosed,
|
22658
22689
|
transportsConnected: this.engine.verifyTransport()
|
22659
|
-
}
|
22690
|
+
} : undefined
|
22660
22691
|
}));
|
22661
22692
|
if (consecutiveFailures >= 3) {
|
22662
22693
|
this.recreateEngine();
|