livekit-client 1.13.3 → 1.14.0
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/README.md +9 -4
- 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 +86 -16
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +92 -12
- 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/utils.d.ts +3 -0
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +7 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrack.d.ts +7 -0
- package/dist/src/room/track/RemoteTrack.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +7 -3
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/ts4.2/src/e2ee/utils.d.ts +3 -0
- package/dist/ts4.2/src/room/events.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +7 -0
- package/dist/ts4.2/src/room/track/RemoteTrack.d.ts +7 -0
- package/dist/ts4.2/src/room/track/options.d.ts +7 -3
- package/package.json +1 -1
- package/src/e2ee/utils.ts +52 -0
- package/src/e2ee/worker/FrameCryptor.ts +45 -27
- package/src/room/RTCEngine.ts +3 -2
- package/src/room/Room.ts +3 -3
- package/src/room/events.ts +1 -1
- package/src/room/participant/LocalParticipant.ts +7 -6
- package/src/room/track/LocalTrack.ts +14 -0
- package/src/room/track/RemoteTrack.ts +14 -0
- package/src/room/track/options.ts +7 -3
@@ -11863,7 +11863,7 @@ function getMatch(exp, ua) {
|
|
11863
11863
|
return match && match.length >= id && match[id] || '';
|
11864
11864
|
}
|
11865
11865
|
|
11866
|
-
var version$1 = "1.
|
11866
|
+
var version$1 = "1.14.0";
|
11867
11867
|
|
11868
11868
|
const version = version$1;
|
11869
11869
|
const protocolVersion = 9;
|
@@ -12168,7 +12168,7 @@ var RoomEvent;
|
|
12168
12168
|
/**
|
12169
12169
|
* LiveKit will attempt to autoplay all audio tracks when you attach them to
|
12170
12170
|
* audio elements. However, if that fails, we'll notify you via AudioPlaybackStatusChanged.
|
12171
|
-
* `Room.
|
12171
|
+
* `Room.canPlaybackAudio` will indicate if audio playback is permitted.
|
12172
12172
|
*/
|
12173
12173
|
RoomEvent["AudioPlaybackStatusChanged"] = "audioPlaybackChanged";
|
12174
12174
|
/**
|
@@ -14062,6 +14062,54 @@ function ratchet(material, salt) {
|
|
14062
14062
|
return crypto.subtle.deriveBits(algorithmOptions, material, 256);
|
14063
14063
|
});
|
14064
14064
|
}
|
14065
|
+
function needsRbspUnescaping(frameData) {
|
14066
|
+
for (var i = 0; i < frameData.length - 3; i++) {
|
14067
|
+
if (frameData[i] == 0 && frameData[i + 1] == 0 && frameData[i + 2] == 3) return true;
|
14068
|
+
}
|
14069
|
+
return false;
|
14070
|
+
}
|
14071
|
+
function parseRbsp(stream) {
|
14072
|
+
const dataOut = [];
|
14073
|
+
var length = stream.length;
|
14074
|
+
for (var i = 0; i < stream.length;) {
|
14075
|
+
// Be careful about over/underflow here. byte_length_ - 3 can underflow, and
|
14076
|
+
// i + 3 can overflow, but byte_length_ - i can't, because i < byte_length_
|
14077
|
+
// above, and that expression will produce the number of bytes left in
|
14078
|
+
// the stream including the byte at i.
|
14079
|
+
if (length - i >= 3 && !stream[i] && !stream[i + 1] && stream[i + 2] == 3) {
|
14080
|
+
// Two rbsp bytes.
|
14081
|
+
dataOut.push(stream[i++]);
|
14082
|
+
dataOut.push(stream[i++]);
|
14083
|
+
// Skip the emulation byte.
|
14084
|
+
i++;
|
14085
|
+
} else {
|
14086
|
+
// Single rbsp byte.
|
14087
|
+
dataOut.push(stream[i++]);
|
14088
|
+
}
|
14089
|
+
}
|
14090
|
+
return new Uint8Array(dataOut);
|
14091
|
+
}
|
14092
|
+
const kZerosInStartSequence = 2;
|
14093
|
+
const kEmulationByte = 3;
|
14094
|
+
function writeRbsp(data_in) {
|
14095
|
+
const dataOut = [];
|
14096
|
+
var numConsecutiveZeros = 0;
|
14097
|
+
for (var i = 0; i < data_in.length; ++i) {
|
14098
|
+
var byte = data_in[i];
|
14099
|
+
if (byte <= kEmulationByte && numConsecutiveZeros >= kZerosInStartSequence) {
|
14100
|
+
// Need to escape.
|
14101
|
+
dataOut.push(kEmulationByte);
|
14102
|
+
numConsecutiveZeros = 0;
|
14103
|
+
}
|
14104
|
+
dataOut.push(byte);
|
14105
|
+
if (byte == 0) {
|
14106
|
+
++numConsecutiveZeros;
|
14107
|
+
} else {
|
14108
|
+
numConsecutiveZeros = 0;
|
14109
|
+
}
|
14110
|
+
}
|
14111
|
+
return new Uint8Array(dataOut);
|
14112
|
+
}
|
14065
14113
|
|
14066
14114
|
/**
|
14067
14115
|
* @experimental
|
@@ -14575,6 +14623,22 @@ class LocalTrack extends Track {
|
|
14575
14623
|
}
|
14576
14624
|
});
|
14577
14625
|
}
|
14626
|
+
/**
|
14627
|
+
* Gets the RTCStatsReport for the LocalTrack's underlying RTCRtpSender
|
14628
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport
|
14629
|
+
*
|
14630
|
+
* @returns Promise<RTCStatsReport> | undefined
|
14631
|
+
*/
|
14632
|
+
getRTCStatsReport() {
|
14633
|
+
var _a;
|
14634
|
+
return __awaiter(this, void 0, void 0, function* () {
|
14635
|
+
if (!((_a = this.sender) === null || _a === void 0 ? void 0 : _a.getStats)) {
|
14636
|
+
return;
|
14637
|
+
}
|
14638
|
+
const statsReport = yield this.sender.getStats();
|
14639
|
+
return statsReport;
|
14640
|
+
});
|
14641
|
+
}
|
14578
14642
|
/**
|
14579
14643
|
* Sets a processor on this track.
|
14580
14644
|
* See https://github.com/livekit/track-processors-js for example usage
|
@@ -16359,6 +16423,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
16359
16423
|
this.subscriber.close();
|
16360
16424
|
this.subscriber = undefined;
|
16361
16425
|
}
|
16426
|
+
this.hasPublished = false;
|
16362
16427
|
this.primaryPC = undefined;
|
16363
16428
|
const dcCleanup = dc => {
|
16364
16429
|
if (!dc) return;
|
@@ -16980,7 +17045,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
16980
17045
|
});
|
16981
17046
|
}
|
16982
17047
|
waitForPCReconnected() {
|
16983
|
-
var _a;
|
17048
|
+
var _a, _b;
|
16984
17049
|
return __awaiter(this, void 0, void 0, function* () {
|
16985
17050
|
const startTime = Date.now();
|
16986
17051
|
let now = startTime;
|
@@ -16994,7 +17059,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
16994
17059
|
// on Safari, we don't get a connectionstatechanged event during ICE restart
|
16995
17060
|
// this means we'd have to check its status manually and update address
|
16996
17061
|
// manually
|
16997
|
-
now - startTime > minReconnectWait && ((_a = this.primaryPC) === null || _a === void 0 ? void 0 : _a.connectionState) === 'connected') {
|
17062
|
+
now - startTime > minReconnectWait && ((_a = this.primaryPC) === null || _a === void 0 ? void 0 : _a.connectionState) === 'connected' && (!this.hasPublished || ((_b = this.publisher) === null || _b === void 0 ? void 0 : _b.pc.connectionState) === 'connected')) {
|
16998
17063
|
this.pcState = PCState.Connected;
|
16999
17064
|
}
|
17000
17065
|
if (this.pcState === PCState.Connected) {
|
@@ -18387,6 +18452,22 @@ class RemoteTrack extends Track {
|
|
18387
18452
|
// use `enabled` of track to enable re-use of transceiver
|
18388
18453
|
super.disable();
|
18389
18454
|
}
|
18455
|
+
/**
|
18456
|
+
* Gets the RTCStatsReport for the RemoteTrack's underlying RTCRtpReceiver
|
18457
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport
|
18458
|
+
*
|
18459
|
+
* @returns Promise<RTCStatsReport> | undefined
|
18460
|
+
*/
|
18461
|
+
getRTCStatsReport() {
|
18462
|
+
var _a;
|
18463
|
+
return __awaiter(this, void 0, void 0, function* () {
|
18464
|
+
if (!((_a = this.receiver) === null || _a === void 0 ? void 0 : _a.getStats)) {
|
18465
|
+
return;
|
18466
|
+
}
|
18467
|
+
const statsReport = yield this.receiver.getStats();
|
18468
|
+
return statsReport;
|
18469
|
+
});
|
18470
|
+
}
|
18390
18471
|
/* @internal */
|
18391
18472
|
startMonitor() {
|
18392
18473
|
if (!this.monitorInterval) {
|
@@ -19994,7 +20075,7 @@ class LocalParticipant extends Participant {
|
|
19994
20075
|
};
|
19995
20076
|
this.engine.client.onSubscribedQualityUpdate = this.handleSubscribedQualityUpdate;
|
19996
20077
|
this.engine.client.onLocalTrackUnpublished = this.handleLocalTrackUnpublished;
|
19997
|
-
this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.
|
20078
|
+
this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.SignalRestarted, this.handleReconnected).on(EngineEvent.SignalResumed, this.handleReconnected).on(EngineEvent.Restarting, this.handleReconnecting).on(EngineEvent.Resuming, this.handleReconnecting).on(EngineEvent.Disconnected, this.handleDisconnected);
|
19998
20079
|
}
|
19999
20080
|
/**
|
20000
20081
|
* Sets and updates the metadata of the local participant.
|
@@ -20219,9 +20300,6 @@ class LocalParticipant extends Participant {
|
|
20219
20300
|
if (options === undefined) {
|
20220
20301
|
options = {};
|
20221
20302
|
}
|
20222
|
-
if (options.resolution === undefined) {
|
20223
|
-
options.resolution = ScreenSharePresets.h1080fps15.resolution;
|
20224
|
-
}
|
20225
20303
|
if (navigator.mediaDevices.getDisplayMedia === undefined) {
|
20226
20304
|
throw new DeviceUnsupportedError('getDisplayMedia not supported');
|
20227
20305
|
}
|
@@ -20423,6 +20501,10 @@ class LocalParticipant extends Participant {
|
|
20423
20501
|
// for svc codecs, disable simulcast and use vp8 for backup codec
|
20424
20502
|
if (track instanceof LocalVideoTrack) {
|
20425
20503
|
if (isSVCCodec(opts.videoCodec)) {
|
20504
|
+
// vp9 svc with screenshare has problem to encode, always use L1T3 here
|
20505
|
+
if (track.source === Track.Source.ScreenShare && opts.videoCodec === 'vp9') {
|
20506
|
+
opts.scalabilityMode = 'L1T3';
|
20507
|
+
}
|
20426
20508
|
// set scalabilityMode to 'L3T3_KEY' by default
|
20427
20509
|
opts.scalabilityMode = (_e = opts.scalabilityMode) !== null && _e !== void 0 ? _e : 'L3T3_KEY';
|
20428
20510
|
}
|
@@ -20950,9 +21032,7 @@ class Room extends eventsExports.EventEmitter {
|
|
20950
21032
|
}
|
20951
21033
|
}
|
20952
21034
|
if (nextUrl) {
|
20953
|
-
livekitLogger.info(
|
20954
|
-
nextUrl
|
20955
|
-
});
|
21035
|
+
livekitLogger.info("Initial connection failed with ConnectionError: ".concat(e.message, ". Retrying with another region: ").concat(nextUrl));
|
20956
21036
|
yield connectFn(resolve, reject, nextUrl);
|
20957
21037
|
} else {
|
20958
21038
|
reject(e);
|
@@ -22903,5 +22983,5 @@ function isFacingModeValue(item) {
|
|
22903
22983
|
return item === undefined || allowedValues.includes(item);
|
22904
22984
|
}
|
22905
22985
|
|
22906
|
-
export { AudioPresets, BaseKeyProvider, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, CriticalTimers, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, MediaDeviceFailure, NegotiationError, Participant, ParticipantEvent, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RoomState, ScreenSharePresets, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, importKey, isBackupCodec, isBrowserSupported, isCodecEqual, isE2EESupported, isInsertableStreamSupported, isScriptTransformSupported, isVideoFrame, mimeTypeToVideoCodecString, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs };
|
22986
|
+
export { AudioPresets, BaseKeyProvider, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, CriticalTimers, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, MediaDeviceFailure, NegotiationError, Participant, ParticipantEvent, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RoomState, ScreenSharePresets, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, importKey, isBackupCodec, isBrowserSupported, isCodecEqual, isE2EESupported, isInsertableStreamSupported, isScriptTransformSupported, isVideoFrame, mimeTypeToVideoCodecString, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
|
22907
22987
|
//# sourceMappingURL=livekit-client.esm.mjs.map
|