livekit-client 1.13.3 → 1.13.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- 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 +87 -8
- 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/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/ts4.2/src/e2ee/utils.d.ts +3 -0
- 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/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/participant/LocalParticipant.ts +2 -2
- package/src/room/track/LocalTrack.ts +14 -0
- package/src/room/track/RemoteTrack.ts +14 -0
@@ -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.13.
|
11866
|
+
var version$1 = "1.13.4";
|
11867
11867
|
|
11868
11868
|
const version = version$1;
|
11869
11869
|
const protocolVersion = 9;
|
@@ -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.
|
@@ -20950,9 +21031,7 @@ class Room extends eventsExports.EventEmitter {
|
|
20950
21031
|
}
|
20951
21032
|
}
|
20952
21033
|
if (nextUrl) {
|
20953
|
-
livekitLogger.info(
|
20954
|
-
nextUrl
|
20955
|
-
});
|
21034
|
+
livekitLogger.info("Initial connection failed with ConnectionError: ".concat(e.message, ". Retrying with another region: ").concat(nextUrl));
|
20956
21035
|
yield connectFn(resolve, reject, nextUrl);
|
20957
21036
|
} else {
|
20958
21037
|
reject(e);
|
@@ -22903,5 +22982,5 @@ function isFacingModeValue(item) {
|
|
22903
22982
|
return item === undefined || allowedValues.includes(item);
|
22904
22983
|
}
|
22905
22984
|
|
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 };
|
22985
|
+
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
22986
|
//# sourceMappingURL=livekit-client.esm.mjs.map
|