livekit-client 2.7.3 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/livekit-client.esm.mjs +37 -14
- 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 +2 -2
- 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 +3 -1
- package/src/room/participant/Participant.ts +2 -1
- package/src/room/participant/RemoteParticipant.ts +3 -1
@@ -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.5";
|
11123
11123
|
|
11124
11124
|
const version = version$1;
|
11125
11125
|
const protocolVersion = 15;
|
@@ -14870,6 +14870,7 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
14870
14870
|
}, this.logContext));
|
14871
14871
|
const sdpParsed = libExports.parse((_a = offer.sdp) !== null && _a !== void 0 ? _a : '');
|
14872
14872
|
sdpParsed.media.forEach(media => {
|
14873
|
+
ensureIPAddrMatchVersion(media);
|
14873
14874
|
if (media.type === 'audio') {
|
14874
14875
|
ensureAudioNackAndStereo(media, [], []);
|
14875
14876
|
} else if (media.type === 'video') {
|
@@ -14922,6 +14923,7 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
14922
14923
|
const answer = yield this.pc.createAnswer();
|
14923
14924
|
const sdpParsed = libExports.parse((_a = answer.sdp) !== null && _a !== void 0 ? _a : '');
|
14924
14925
|
sdpParsed.media.forEach(media => {
|
14926
|
+
ensureIPAddrMatchVersion(media);
|
14925
14927
|
if (media.type === 'audio') {
|
14926
14928
|
ensureAudioNackAndStereo(media, this.remoteStereoMids, this.remoteNackMids);
|
14927
14929
|
}
|
@@ -15176,6 +15178,19 @@ function extractStereoAndNackAudioFromOffer(offer) {
|
|
15176
15178
|
nackMids
|
15177
15179
|
};
|
15178
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
|
+
}
|
15179
15194
|
|
15180
15195
|
const defaultVideoCodec = 'vp8';
|
15181
15196
|
const publishDefaults = {
|
@@ -18883,8 +18898,8 @@ class Participant extends eventsExports.EventEmitter {
|
|
18883
18898
|
return Object.freeze(Object.assign({}, this._attributes));
|
18884
18899
|
}
|
18885
18900
|
/** @internal */
|
18886
|
-
constructor(sid, identity, name, metadata, loggerOptions) {
|
18887
|
-
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;
|
18888
18903
|
var _a;
|
18889
18904
|
super();
|
18890
18905
|
/** audio level between 0-1.0, 1 being loudest, 0 being softest */
|
@@ -18904,7 +18919,7 @@ class Participant extends eventsExports.EventEmitter {
|
|
18904
18919
|
this.videoTrackPublications = new Map();
|
18905
18920
|
this.trackPublications = new Map();
|
18906
18921
|
this._kind = kind;
|
18907
|
-
this._attributes = {};
|
18922
|
+
this._attributes = attributes !== null && attributes !== void 0 ? attributes : {};
|
18908
18923
|
}
|
18909
18924
|
getTrackPublications() {
|
18910
18925
|
return Array.from(this.trackPublications.values());
|
@@ -19091,7 +19106,7 @@ function trackPermissionToProto(perms) {
|
|
19091
19106
|
class LocalParticipant extends Participant {
|
19092
19107
|
/** @internal */
|
19093
19108
|
constructor(sid, identity, engine, options) {
|
19094
|
-
super(sid, identity, undefined, undefined, {
|
19109
|
+
super(sid, identity, undefined, undefined, undefined, {
|
19095
19110
|
loggerName: options.loggerName,
|
19096
19111
|
loggerContextCb: () => this.engine.logContext
|
19097
19112
|
});
|
@@ -20147,6 +20162,8 @@ class LocalParticipant extends Participant {
|
|
20147
20162
|
}
|
20148
20163
|
if (stopOnUnpublish) {
|
20149
20164
|
track.stop();
|
20165
|
+
} else {
|
20166
|
+
track.stopMonitor();
|
20150
20167
|
}
|
20151
20168
|
let negotiationNeeded = false;
|
20152
20169
|
const trackSender = track.sender;
|
@@ -20912,7 +20929,7 @@ class RemoteTrackPublication extends TrackPublication {
|
|
20912
20929
|
class RemoteParticipant extends Participant {
|
20913
20930
|
/** @internal */
|
20914
20931
|
static fromParticipantInfo(signalClient, pi, loggerOptions) {
|
20915
|
-
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);
|
20916
20933
|
}
|
20917
20934
|
get logContext() {
|
20918
20935
|
return Object.assign(Object.assign({}, super.logContext), {
|
@@ -20921,9 +20938,9 @@ class RemoteParticipant extends Participant {
|
|
20921
20938
|
});
|
20922
20939
|
}
|
20923
20940
|
/** @internal */
|
20924
|
-
constructor(signalClient, sid, identity, name, metadata, loggerOptions) {
|
20925
|
-
let kind = arguments.length >
|
20926
|
-
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);
|
20927
20944
|
this.signalClient = signalClient;
|
20928
20945
|
this.trackPublications = new Map();
|
20929
20946
|
this.audioTrackPublications = new Map();
|
@@ -21955,7 +21972,11 @@ class Room extends eventsExports.EventEmitter {
|
|
21955
21972
|
setupE2EE() {
|
21956
21973
|
var _a;
|
21957
21974
|
if (this.options.e2ee) {
|
21958
|
-
|
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
|
+
}
|
21959
21980
|
this.e2eeManager.on(EncryptionEvent.ParticipantEncryptionStatusChanged, (enabled, participant) => {
|
21960
21981
|
if (participant instanceof LocalParticipant) {
|
21961
21982
|
this.isE2EEEnabled = enabled;
|
@@ -22456,13 +22477,15 @@ class Room extends eventsExports.EventEmitter {
|
|
22456
22477
|
});
|
22457
22478
|
});
|
22458
22479
|
this.localParticipant.trackPublications.forEach(pub => {
|
22459
|
-
var _a, _b;
|
22480
|
+
var _a, _b, _c;
|
22460
22481
|
if (pub.track) {
|
22461
22482
|
this.localParticipant.unpublishTrack(pub.track, shouldStopTracks);
|
22462
22483
|
}
|
22463
22484
|
if (shouldStopTracks) {
|
22464
22485
|
(_a = pub.track) === null || _a === void 0 ? void 0 : _a.detach();
|
22465
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();
|
22466
22489
|
}
|
22467
22490
|
});
|
22468
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);
|
@@ -22542,7 +22565,7 @@ class Room extends eventsExports.EventEmitter {
|
|
22542
22565
|
loggerName: this.options.loggerName
|
22543
22566
|
});
|
22544
22567
|
} else {
|
22545
|
-
participant = new RemoteParticipant(this.engine.client, '', identity, undefined, undefined, {
|
22568
|
+
participant = new RemoteParticipant(this.engine.client, '', identity, undefined, undefined, undefined, {
|
22546
22569
|
loggerContextCb: () => this.logContext,
|
22547
22570
|
loggerName: this.options.loggerName
|
22548
22571
|
});
|
@@ -22661,10 +22684,10 @@ class Room extends eventsExports.EventEmitter {
|
|
22661
22684
|
consecutiveFailures++;
|
22662
22685
|
this.log.warn('detected connection state mismatch', Object.assign(Object.assign({}, this.logContext), {
|
22663
22686
|
numFailures: consecutiveFailures,
|
22664
|
-
engine: {
|
22687
|
+
engine: this.engine ? {
|
22665
22688
|
closed: this.engine.isClosed,
|
22666
22689
|
transportsConnected: this.engine.verifyTransport()
|
22667
|
-
}
|
22690
|
+
} : undefined
|
22668
22691
|
}));
|
22669
22692
|
if (consecutiveFailures >= 3) {
|
22670
22693
|
this.recreateEngine();
|