livekit-client 2.19.2 → 2.20.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 +31 -27
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +334 -126
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.fm.worker.js +2 -0
- package/dist/{livekit-client.pt.worker.js.map → livekit-client.fm.worker.js.map} +1 -1
- package/dist/{livekit-client.pt.worker.mjs → livekit-client.fm.worker.mjs} +12 -4
- package/dist/livekit-client.fm.worker.mjs.map +1 -0
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts +2 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +6 -5
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/utils.d.ts +1 -0
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/DataCryptor.d.ts +1 -0
- package/dist/src/e2ee/worker/DataCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts +9 -8
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts +1 -0
- package/dist/src/e2ee/worker/naluUtils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/sifPayload.d.ts +1 -0
- package/dist/src/e2ee/worker/sifPayload.d.ts.map +1 -1
- package/dist/src/{packetTrailer/PacketTrailerManager.d.ts → frameMetadata/FrameMetadataManager.d.ts} +8 -4
- package/dist/src/{packetTrailer/PacketTrailerManager.d.ts.map → frameMetadata/FrameMetadataManager.d.ts.map} +1 -1
- package/dist/src/{packetTrailer/packetTrailer.d.ts → frameMetadata/frameMetadata.d.ts} +8 -7
- package/dist/src/frameMetadata/frameMetadata.d.ts.map +1 -0
- package/dist/src/{packetTrailer → frameMetadata}/types.d.ts +11 -6
- package/dist/src/frameMetadata/types.d.ts.map +1 -0
- package/dist/src/frameMetadata/utils.d.ts +9 -0
- package/dist/src/{packetTrailer → frameMetadata}/utils.d.ts.map +1 -1
- package/dist/src/frameMetadata/worker/frameMetadata.worker.d.ts +2 -0
- package/dist/src/frameMetadata/worker/frameMetadata.worker.d.ts.map +1 -0
- package/dist/src/index.d.ts +10 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/options.d.ts +8 -4
- package/dist/src/options.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +41 -1
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts +1 -0
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +4 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +3 -2
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-track/depacketizer.d.ts.map +1 -1
- package/dist/src/room/data-track/frame.d.ts +1 -0
- package/dist/src/room/data-track/frame.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/types.d.ts +1 -0
- package/dist/src/room/data-track/outgoing/types.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/extensions.d.ts +1 -0
- package/dist/src/room/data-track/packet/extensions.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/index.d.ts +1 -0
- package/dist/src/room/data-track/packet/index.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/serializable.d.ts +1 -0
- package/dist/src/room/data-track/packet/serializable.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +3 -2
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -0
- 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/token-source/TokenSource.d.ts.map +1 -1
- package/dist/src/room/token-source/types.d.ts +1 -0
- package/dist/src/room/token-source/types.d.ts.map +1 -1
- package/dist/src/room/token-source/utils.d.ts.map +1 -1
- package/dist/src/room/track/FrameMetadataExtractor.d.ts +19 -0
- package/dist/src/room/track/FrameMetadataExtractor.d.ts.map +1 -0
- package/dist/src/room/track/RemoteVideoTrack.d.ts +7 -7
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +1 -0
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +17 -5
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/record.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/type-polyfills/non-shared-typed-arrays.d.ts +2 -0
- package/dist/src/type-polyfills/non-shared-typed-arrays.d.ts.map +1 -0
- package/dist/src/utils/dataPacketBuffer.d.ts +1 -0
- package/dist/src/utils/dataPacketBuffer.d.ts.map +1 -1
- package/dist/ts4.2/e2ee/E2eeManager.d.ts +2 -1
- package/dist/ts4.2/e2ee/types.d.ts +6 -5
- package/dist/ts4.2/e2ee/utils.d.ts +1 -0
- package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +1 -0
- package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +9 -8
- package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +1 -0
- package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +1 -0
- package/dist/ts4.2/{packetTrailer/PacketTrailerManager.d.ts → frameMetadata/FrameMetadataManager.d.ts} +8 -4
- package/dist/ts4.2/{packetTrailer/packetTrailer.d.ts → frameMetadata/frameMetadata.d.ts} +8 -7
- package/dist/ts4.2/{packetTrailer → frameMetadata}/types.d.ts +11 -6
- package/dist/ts4.2/frameMetadata/utils.d.ts +9 -0
- package/dist/ts4.2/frameMetadata/worker/frameMetadata.worker.d.ts +2 -0
- package/dist/ts4.2/index.d.ts +9 -3
- package/dist/ts4.2/options.d.ts +8 -4
- package/dist/ts4.2/room/PCTransport.d.ts +41 -1
- package/dist/ts4.2/room/PCTransportManager.d.ts +1 -0
- package/dist/ts4.2/room/RTCEngine.d.ts +4 -1
- package/dist/ts4.2/room/Room.d.ts +3 -2
- package/dist/ts4.2/room/data-track/frame.d.ts +1 -0
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +1 -0
- package/dist/ts4.2/room/data-track/packet/extensions.d.ts +1 -0
- package/dist/ts4.2/room/data-track/packet/index.d.ts +1 -0
- package/dist/ts4.2/room/data-track/packet/serializable.d.ts +1 -0
- package/dist/ts4.2/room/participant/LocalParticipant.d.ts +3 -2
- package/dist/ts4.2/room/participant/Participant.d.ts +1 -0
- package/dist/ts4.2/room/token-source/types.d.ts +1 -0
- package/dist/ts4.2/room/track/FrameMetadataExtractor.d.ts +19 -0
- package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +7 -7
- package/dist/ts4.2/room/track/Track.d.ts +1 -0
- package/dist/ts4.2/room/track/options.d.ts +17 -5
- package/dist/ts4.2/room/utils.d.ts +1 -0
- package/dist/ts4.2/type-polyfills/non-shared-typed-arrays.d.ts +2 -0
- package/dist/ts4.2/utils/dataPacketBuffer.d.ts +1 -0
- package/package.json +24 -19
- package/src/api/SignalClient.test.ts +4 -4
- package/src/api/SignalClient.ts +8 -3
- package/src/api/WebSocketStream.test.ts +7 -7
- package/src/e2ee/E2eeManager.ts +16 -12
- package/src/e2ee/types.ts +6 -5
- package/src/e2ee/utils.ts +1 -0
- package/src/e2ee/worker/DataCryptor.ts +1 -0
- package/src/e2ee/worker/FrameCryptor.test.ts +6 -5
- package/src/e2ee/worker/FrameCryptor.ts +28 -23
- package/src/e2ee/worker/ParticipantKeyHandler.test.ts +1 -0
- package/src/e2ee/worker/e2ee.worker.ts +6 -5
- package/src/e2ee/worker/naluUtils.ts +1 -0
- package/src/e2ee/worker/sifPayload.ts +1 -0
- package/src/e2ee/worker/tsconfig.json +4 -1
- package/src/{packetTrailer/PacketTrailerManager.test.ts → frameMetadata/FrameMetadataManager.test.ts} +10 -8
- package/src/{packetTrailer/PacketTrailerManager.ts → frameMetadata/FrameMetadataManager.ts} +21 -15
- package/src/{packetTrailer/packetTrailer.test.ts → frameMetadata/frameMetadata.test.ts} +84 -1
- package/src/{packetTrailer/packetTrailer.ts → frameMetadata/frameMetadata.ts} +17 -9
- package/src/{packetTrailer → frameMetadata}/types.ts +13 -6
- package/src/{packetTrailer → frameMetadata}/utils.test.ts +19 -19
- package/src/{packetTrailer → frameMetadata}/utils.ts +11 -11
- package/src/{packetTrailer/worker/packetTrailer.worker.ts → frameMetadata/worker/frameMetadata.worker.ts} +5 -5
- package/src/{packetTrailer → frameMetadata}/worker/tsconfig.json +4 -1
- package/src/index.ts +13 -2
- package/src/options.ts +9 -4
- package/src/room/PCTransport.test.ts +150 -0
- package/src/room/PCTransport.ts +117 -0
- package/src/room/PCTransportManager.ts +4 -0
- package/src/room/RTCEngine.test.ts +143 -9
- package/src/room/RTCEngine.ts +112 -31
- package/src/room/Room.ts +11 -10
- package/src/room/data-track/depacketizer.ts +1 -0
- package/src/room/data-track/frame.ts +1 -0
- package/src/room/data-track/outgoing/types.ts +1 -0
- package/src/room/data-track/packet/extensions.ts +1 -0
- package/src/room/data-track/packet/index.ts +1 -0
- package/src/room/data-track/packet/serializable.ts +1 -0
- package/src/room/participant/LocalParticipant.test.ts +19 -19
- package/src/room/participant/LocalParticipant.ts +22 -16
- package/src/room/participant/Participant.ts +1 -0
- package/src/room/participant/publishUtils.test.ts +6 -0
- package/src/room/participant/publishUtils.ts +4 -1
- package/src/room/rpc/client/RpcClientManager.ts +1 -1
- package/src/room/rpc/server/RpcServerManager.ts +1 -1
- package/src/room/token-source/TokenSource.ts +9 -23
- package/src/room/token-source/types.ts +1 -0
- package/src/room/token-source/utils.ts +1 -0
- package/src/room/track/{PacketTrailerExtractor.ts → FrameMetadataExtractor.ts} +8 -8
- package/src/room/track/RemoteVideoTrack.ts +7 -11
- package/src/room/track/Track.ts +1 -0
- package/src/room/track/options.ts +19 -5
- package/src/room/track/record.ts +1 -0
- package/src/room/utils.ts +1 -0
- package/src/type-polyfills/{non-shared-typed-arrays.d.ts → non-shared-typed-arrays.ts} +6 -1
- package/src/utils/dataPacketBuffer.ts +2 -0
- package/dist/livekit-client.pt.worker.js +0 -2
- package/dist/livekit-client.pt.worker.mjs.map +0 -1
- package/dist/src/packetTrailer/packetTrailer.d.ts.map +0 -1
- package/dist/src/packetTrailer/types.d.ts.map +0 -1
- package/dist/src/packetTrailer/utils.d.ts +0 -9
- package/dist/src/packetTrailer/worker/packetTrailer.worker.d.ts +0 -2
- package/dist/src/packetTrailer/worker/packetTrailer.worker.d.ts.map +0 -1
- package/dist/src/room/track/PacketTrailerExtractor.d.ts +0 -19
- package/dist/src/room/track/PacketTrailerExtractor.d.ts.map +0 -1
- package/dist/ts4.2/packetTrailer/utils.d.ts +0 -9
- package/dist/ts4.2/packetTrailer/worker/packetTrailer.worker.d.ts +0 -2
- package/dist/ts4.2/room/track/PacketTrailerExtractor.d.ts +0 -19
|
@@ -8776,8 +8776,7 @@ function requireEvents() {
|
|
|
8776
8776
|
}
|
|
8777
8777
|
}
|
|
8778
8778
|
return events.exports;
|
|
8779
|
-
}var eventsExports = requireEvents()
|
|
8780
|
-
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);/*
|
|
8779
|
+
}var eventsExports = requireEvents();/*
|
|
8781
8780
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
8782
8781
|
*
|
|
8783
8782
|
* Use of this source code is governed by a BSD-style license
|
|
@@ -8938,10 +8937,15 @@ function detectBrowser(window) {
|
|
|
8938
8937
|
return brand.brand === 'Chromium';
|
|
8939
8938
|
});
|
|
8940
8939
|
if (chromium) {
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8940
|
+
const version = parseInt(chromium.version, 10);
|
|
8941
|
+
// navigator.userAgentData was introduced in Chromium 90
|
|
8942
|
+
// so any Chromium brand reporting a version below 90 is invalid
|
|
8943
|
+
if (version >= 90) {
|
|
8944
|
+
return {
|
|
8945
|
+
browser: 'chrome',
|
|
8946
|
+
version
|
|
8947
|
+
};
|
|
8948
|
+
}
|
|
8945
8949
|
}
|
|
8946
8950
|
}
|
|
8947
8951
|
if (navigator.mozGetUserMedia) {
|
|
@@ -9050,6 +9054,9 @@ function filterStats(result, track, outbound) {
|
|
|
9050
9054
|
/* eslint-env node */
|
|
9051
9055
|
const logging = log$4;
|
|
9052
9056
|
function shimGetUserMedia$2(window, browserDetails) {
|
|
9057
|
+
if (browserDetails.version >= 64) {
|
|
9058
|
+
return;
|
|
9059
|
+
}
|
|
9053
9060
|
const navigator = window && window.navigator;
|
|
9054
9061
|
if (!navigator.mediaDevices) {
|
|
9055
9062
|
return;
|
|
@@ -9203,6 +9210,8 @@ function shimGetUserMedia$2(window, browserDetails) {
|
|
|
9203
9210
|
// Even though Chrome 45 has navigator.mediaDevices and a getUserMedia
|
|
9204
9211
|
// function which returns a Promise, it does not accept spec-style
|
|
9205
9212
|
// constraints.
|
|
9213
|
+
// Fixed in M64 too, see
|
|
9214
|
+
// https://groups.google.com/g/discuss-webrtc/c/DMPTKcXVUQ4/m/85FaASoFBwAJ?
|
|
9206
9215
|
if (navigator.mediaDevices.getUserMedia) {
|
|
9207
9216
|
const origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
|
|
9208
9217
|
navigator.mediaDevices.getUserMedia = function (cs) {
|
|
@@ -9788,6 +9797,9 @@ function fixNegotiationNeeded(window, browserDetails) {
|
|
|
9788
9797
|
/* eslint-env node */
|
|
9789
9798
|
function shimGetUserMedia$1(window, browserDetails) {
|
|
9790
9799
|
const navigator = window && window.navigator;
|
|
9800
|
+
if (!navigator.mediaDevices) {
|
|
9801
|
+
return;
|
|
9802
|
+
}
|
|
9791
9803
|
const MediaStreamTrack = window && window.MediaStreamTrack;
|
|
9792
9804
|
navigator.getUserMedia = function (constraints, onSuccess, onError) {
|
|
9793
9805
|
// Replace Firefox 44+'s deprecation warning with unprefixed version.
|
|
@@ -9841,10 +9853,10 @@ function shimGetUserMedia$1(window, browserDetails) {
|
|
|
9841
9853
|
/* eslint-env node */
|
|
9842
9854
|
|
|
9843
9855
|
function shimGetDisplayMedia(window, preferredMediaSource) {
|
|
9844
|
-
if (window.navigator.mediaDevices
|
|
9856
|
+
if (!window.navigator.mediaDevices) {
|
|
9845
9857
|
return;
|
|
9846
9858
|
}
|
|
9847
|
-
if (
|
|
9859
|
+
if (window.navigator.mediaDevices && 'getDisplayMedia' in window.navigator.mediaDevices) {
|
|
9848
9860
|
return;
|
|
9849
9861
|
}
|
|
9850
9862
|
window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {
|
|
@@ -10024,13 +10036,17 @@ function shimRTCDataChannel(window) {
|
|
|
10024
10036
|
window.RTCDataChannel = window.DataChannel;
|
|
10025
10037
|
}
|
|
10026
10038
|
}
|
|
10027
|
-
function shimAddTransceiver(window) {
|
|
10039
|
+
function shimAddTransceiver(window, browserDetails) {
|
|
10028
10040
|
// https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
|
|
10029
10041
|
// Firefox ignores the init sendEncodings options passed to addTransceiver
|
|
10030
10042
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
|
|
10031
10043
|
if (!(typeof window === 'object' && window.RTCPeerConnection)) {
|
|
10032
10044
|
return;
|
|
10033
10045
|
}
|
|
10046
|
+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
|
|
10047
|
+
if (browserDetails.version >= 110) {
|
|
10048
|
+
return;
|
|
10049
|
+
}
|
|
10034
10050
|
const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;
|
|
10035
10051
|
if (origAddTransceiver) {
|
|
10036
10052
|
window.RTCPeerConnection.prototype.addTransceiver = function addTransceiver() {
|
|
@@ -10090,10 +10106,14 @@ function shimAddTransceiver(window) {
|
|
|
10090
10106
|
};
|
|
10091
10107
|
}
|
|
10092
10108
|
}
|
|
10093
|
-
function shimGetParameters(window) {
|
|
10109
|
+
function shimGetParameters(window, browserDetails) {
|
|
10094
10110
|
if (!(typeof window === 'object' && window.RTCRtpSender)) {
|
|
10095
10111
|
return;
|
|
10096
10112
|
}
|
|
10113
|
+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
|
|
10114
|
+
if (browserDetails.version >= 110) {
|
|
10115
|
+
return;
|
|
10116
|
+
}
|
|
10097
10117
|
const origGetParameters = window.RTCRtpSender.prototype.getParameters;
|
|
10098
10118
|
if (origGetParameters) {
|
|
10099
10119
|
window.RTCRtpSender.prototype.getParameters = function getParameters() {
|
|
@@ -10105,13 +10125,17 @@ function shimGetParameters(window) {
|
|
|
10105
10125
|
};
|
|
10106
10126
|
}
|
|
10107
10127
|
}
|
|
10108
|
-
function shimCreateOffer(window) {
|
|
10128
|
+
function shimCreateOffer(window, browserDetails) {
|
|
10109
10129
|
// https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
|
|
10110
10130
|
// Firefox ignores the init sendEncodings options passed to addTransceiver
|
|
10111
10131
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
|
|
10112
10132
|
if (!(typeof window === 'object' && window.RTCPeerConnection)) {
|
|
10113
10133
|
return;
|
|
10114
10134
|
}
|
|
10135
|
+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
|
|
10136
|
+
if (browserDetails.version >= 110) {
|
|
10137
|
+
return;
|
|
10138
|
+
}
|
|
10115
10139
|
const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
|
|
10116
10140
|
window.RTCPeerConnection.prototype.createOffer = function createOffer() {
|
|
10117
10141
|
if (this.setParametersPromises && this.setParametersPromises.length) {
|
|
@@ -10124,13 +10148,17 @@ function shimCreateOffer(window) {
|
|
|
10124
10148
|
return origCreateOffer.apply(this, arguments);
|
|
10125
10149
|
};
|
|
10126
10150
|
}
|
|
10127
|
-
function shimCreateAnswer(window) {
|
|
10151
|
+
function shimCreateAnswer(window, browserDetails) {
|
|
10128
10152
|
// https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
|
|
10129
10153
|
// Firefox ignores the init sendEncodings options passed to addTransceiver
|
|
10130
10154
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
|
|
10131
10155
|
if (!(typeof window === 'object' && window.RTCPeerConnection)) {
|
|
10132
10156
|
return;
|
|
10133
10157
|
}
|
|
10158
|
+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
|
|
10159
|
+
if (browserDetails.version >= 110) {
|
|
10160
|
+
return;
|
|
10161
|
+
}
|
|
10134
10162
|
const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;
|
|
10135
10163
|
window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {
|
|
10136
10164
|
if (this.setParametersPromises && this.setParametersPromises.length) {
|
|
@@ -11292,6 +11320,15 @@ function shimMaxMessageSize(window, browserDetails) {
|
|
|
11292
11320
|
if (!window.RTCPeerConnection) {
|
|
11293
11321
|
return;
|
|
11294
11322
|
}
|
|
11323
|
+
if (browserDetails.browser === 'chrome' && browserDetails.version > 102) {
|
|
11324
|
+
// Unified plan is supported so no need to do anything.
|
|
11325
|
+
return;
|
|
11326
|
+
}
|
|
11327
|
+
if (browserDetails.browser === 'firefox' && browserDetails.version >= 113) {
|
|
11328
|
+
// Native RTCSctpTransport, see
|
|
11329
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1278299
|
|
11330
|
+
return;
|
|
11331
|
+
}
|
|
11295
11332
|
if (!('sctp' in window.RTCPeerConnection.prototype)) {
|
|
11296
11333
|
Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {
|
|
11297
11334
|
get() {
|
|
@@ -11428,7 +11465,7 @@ function shimSendThrowTypeError(window, browserDetails) {
|
|
|
11428
11465
|
if (!(window.RTCPeerConnection && 'createDataChannel' in window.RTCPeerConnection.prototype)) {
|
|
11429
11466
|
return;
|
|
11430
11467
|
}
|
|
11431
|
-
if (browserDetails.browser === 'chrome' && browserDetails.version
|
|
11468
|
+
if (browserDetails.browser === 'chrome' && browserDetails.version >= 149) {
|
|
11432
11469
|
// Fixed by https://issues.chromium.org/issues/490588131
|
|
11433
11470
|
return;
|
|
11434
11471
|
}
|
|
@@ -11707,10 +11744,10 @@ function adapterFactory() {
|
|
|
11707
11744
|
shimSenderGetStats(window);
|
|
11708
11745
|
shimReceiverGetStats(window);
|
|
11709
11746
|
shimRTCDataChannel(window);
|
|
11710
|
-
shimAddTransceiver(window);
|
|
11711
|
-
shimGetParameters(window);
|
|
11712
|
-
shimCreateOffer(window);
|
|
11713
|
-
shimCreateAnswer(window);
|
|
11747
|
+
shimAddTransceiver(window, browserDetails);
|
|
11748
|
+
shimGetParameters(window, browserDetails);
|
|
11749
|
+
shimCreateOffer(window, browserDetails);
|
|
11750
|
+
shimCreateAnswer(window, browserDetails);
|
|
11714
11751
|
shimRTCIceCandidate(window);
|
|
11715
11752
|
shimConnectionState(window);
|
|
11716
11753
|
shimMaxMessageSize(window, browserDetails);
|
|
@@ -11844,7 +11881,7 @@ function getMatch(exp, ua) {
|
|
|
11844
11881
|
}
|
|
11845
11882
|
function getOSVersion(ua) {
|
|
11846
11883
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
|
11847
|
-
}var version$1 = "2.
|
|
11884
|
+
}var version$1 = "2.20.1";const version = version$1;
|
|
11848
11885
|
const protocolVersion = 17;
|
|
11849
11886
|
/** Initial client protocol. */
|
|
11850
11887
|
const CLIENT_PROTOCOL_DEFAULT = 0;
|
|
@@ -14443,16 +14480,16 @@ class CryptorError extends LivekitError {
|
|
|
14443
14480
|
this.reason = reason;
|
|
14444
14481
|
this.participantIdentity = participantIdentity;
|
|
14445
14482
|
}
|
|
14446
|
-
}function
|
|
14483
|
+
}function shouldUseFrameMetadataScriptTransform() {
|
|
14447
14484
|
return isScriptTransformSupportedForWorker();
|
|
14448
14485
|
}
|
|
14449
|
-
function
|
|
14450
|
-
return !!(options === null || options === void 0 ? void 0 : options.worker) && (isInsertableStreamSupported() ||
|
|
14486
|
+
function isFrameMetadataSupported(options) {
|
|
14487
|
+
return !!(options === null || options === void 0 ? void 0 : options.worker) && (isInsertableStreamSupported() || shouldUseFrameMetadataScriptTransform());
|
|
14451
14488
|
}
|
|
14452
|
-
function
|
|
14489
|
+
function hasFrameMetadataPublishOptions(options) {
|
|
14453
14490
|
return !!((options === null || options === void 0 ? void 0 : options.timestamp) || (options === null || options === void 0 ? void 0 : options.frameId));
|
|
14454
14491
|
}
|
|
14455
|
-
function
|
|
14492
|
+
function getFrameMetadataFeatures(options) {
|
|
14456
14493
|
const features = [];
|
|
14457
14494
|
if (options === null || options === void 0 ? void 0 : options.timestamp) {
|
|
14458
14495
|
features.push(PacketTrailerFeature.PTF_USER_TIMESTAMP);
|
|
@@ -14462,7 +14499,7 @@ function getPacketTrailerFeatures(options) {
|
|
|
14462
14499
|
}
|
|
14463
14500
|
return features;
|
|
14464
14501
|
}
|
|
14465
|
-
function
|
|
14502
|
+
function getFrameMetadataPublishOptions(features) {
|
|
14466
14503
|
if (!features || features.length === 0) {
|
|
14467
14504
|
return undefined;
|
|
14468
14505
|
}
|
|
@@ -14736,14 +14773,14 @@ class RemoteVideoTrack extends RemoteTrack {
|
|
|
14736
14773
|
* Use with the `TrackEvent.TimeSyncUpdate` event to correlate displayed frames
|
|
14737
14774
|
* with their capture-time metadata.
|
|
14738
14775
|
*
|
|
14739
|
-
* Requires the room to be configured with the `
|
|
14740
|
-
* and the publishing track to have
|
|
14776
|
+
* Requires the room to be configured with the `frameMetadata` worker option
|
|
14777
|
+
* and the publishing track to have frame metadata features enabled.
|
|
14741
14778
|
*
|
|
14742
14779
|
*/
|
|
14743
14780
|
lookupFrameMetadata(_ref) {
|
|
14744
14781
|
let rtpTimestamp = _ref.rtpTimestamp;
|
|
14745
14782
|
var _a;
|
|
14746
|
-
return (_a = this.
|
|
14783
|
+
return (_a = this.frameMetadataExtractor) === null || _a === void 0 ? void 0 : _a.lookupMetadata(rtpTimestamp);
|
|
14747
14784
|
}
|
|
14748
14785
|
setStreamState(value) {
|
|
14749
14786
|
super.setStreamState(value);
|
|
@@ -15136,7 +15173,7 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15136
15173
|
}
|
|
15137
15174
|
break;
|
|
15138
15175
|
case 'packetTrailerMetadata':
|
|
15139
|
-
this.
|
|
15176
|
+
this.handleFrameMetadata(data.trackId, data.rtpTimestamp, data.ssrc, data.metadata);
|
|
15140
15177
|
break;
|
|
15141
15178
|
}
|
|
15142
15179
|
};
|
|
@@ -15203,14 +15240,14 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15203
15240
|
this.postSifTrailer(trailer);
|
|
15204
15241
|
}
|
|
15205
15242
|
}
|
|
15206
|
-
|
|
15243
|
+
handleFrameMetadata(trackId, rtpTimestamp, ssrc, metadata) {
|
|
15207
15244
|
if (!this.room) {
|
|
15208
15245
|
return;
|
|
15209
15246
|
}
|
|
15210
15247
|
for (const participant of [this.room.localParticipant, ...this.room.remoteParticipants.values()]) {
|
|
15211
15248
|
for (const pub of participant.trackPublications.values()) {
|
|
15212
|
-
if (pub.track && pub.track.mediaStreamID === trackId && pub.track instanceof RemoteVideoTrack && pub.track.
|
|
15213
|
-
pub.track.
|
|
15249
|
+
if (pub.track && pub.track.mediaStreamID === trackId && pub.track instanceof RemoteVideoTrack && pub.track.frameMetadataExtractor) {
|
|
15250
|
+
pub.track.frameMetadataExtractor.storeMetadata(rtpTimestamp, ssrc, metadata);
|
|
15214
15251
|
return;
|
|
15215
15252
|
}
|
|
15216
15253
|
}
|
|
@@ -15408,12 +15445,12 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15408
15445
|
this.handleReceiver(track.receiver, track.mediaStreamID, remoteId, track.kind === 'video' ? mimeTypeToVideoCodecString(trackInfo.mimeType) : undefined, hasPacketTrailer);
|
|
15409
15446
|
}
|
|
15410
15447
|
setupE2EESender(track, sender) {
|
|
15411
|
-
var _a;
|
|
15448
|
+
var _a, _b, _c;
|
|
15412
15449
|
if (!isLocalTrack(track) || !sender) {
|
|
15413
15450
|
if (!sender) livekitLogger.warn('early return because sender is not ready');
|
|
15414
15451
|
return;
|
|
15415
15452
|
}
|
|
15416
|
-
this.handleSender(sender, track.mediaStreamID, undefined, isVideoTrack(track) ? (_a = track.publishOptions) === null || _a === void 0 ? void 0 : _a.packetTrailer : undefined);
|
|
15453
|
+
this.handleSender(sender, track.mediaStreamID, undefined, isVideoTrack(track) ? (_b = (_a = track.publishOptions) === null || _a === void 0 ? void 0 : _a.frameMetadata) !== null && _b !== void 0 ? _b : (_c = track.publishOptions) === null || _c === void 0 ? void 0 : _c.packetTrailer : undefined);
|
|
15417
15454
|
}
|
|
15418
15455
|
/**
|
|
15419
15456
|
* Handles the given {@code RTCRtpReceiver} by creating a {@code TransformStream} which will inject
|
|
@@ -15487,7 +15524,7 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15487
15524
|
* a frame encoder.
|
|
15488
15525
|
*
|
|
15489
15526
|
*/
|
|
15490
|
-
handleSender(sender, trackId, codec,
|
|
15527
|
+
handleSender(sender, trackId, codec, frameMetadata) {
|
|
15491
15528
|
var _a;
|
|
15492
15529
|
if (E2EE_FLAG in sender || !this.worker) {
|
|
15493
15530
|
return;
|
|
@@ -15502,8 +15539,8 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15502
15539
|
participantIdentity: this.room.localParticipant.identity,
|
|
15503
15540
|
trackId,
|
|
15504
15541
|
codec,
|
|
15505
|
-
hasPacketTrailer:
|
|
15506
|
-
packetTrailer
|
|
15542
|
+
hasPacketTrailer: hasFrameMetadataPublishOptions(frameMetadata),
|
|
15543
|
+
packetTrailer: frameMetadata
|
|
15507
15544
|
};
|
|
15508
15545
|
// @ts-ignore
|
|
15509
15546
|
sender.transform = new RTCRtpScriptTransform(this.worker, options);
|
|
@@ -15520,8 +15557,8 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15520
15557
|
trackId,
|
|
15521
15558
|
participantIdentity: this.room.localParticipant.identity,
|
|
15522
15559
|
isReuse: false,
|
|
15523
|
-
hasPacketTrailer:
|
|
15524
|
-
packetTrailer
|
|
15560
|
+
hasPacketTrailer: hasFrameMetadataPublishOptions(frameMetadata),
|
|
15561
|
+
packetTrailer: frameMetadata
|
|
15525
15562
|
}
|
|
15526
15563
|
};
|
|
15527
15564
|
this.worker.postMessage(msg, [senderStreams.readable, senderStreams.writable]);
|
|
@@ -15531,16 +15568,16 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15531
15568
|
}
|
|
15532
15569
|
}const MAX_ENTRIES = 300;
|
|
15533
15570
|
/**
|
|
15534
|
-
* Caches
|
|
15571
|
+
* Caches frame metadata extracted from received video frames,
|
|
15535
15572
|
* keyed by RTP timestamp so it can be looked up when the frame is displayed.
|
|
15536
15573
|
*
|
|
15537
|
-
* Metadata is populated either by the
|
|
15538
|
-
* `
|
|
15574
|
+
* Metadata is populated either by the frame metadata worker managed by
|
|
15575
|
+
* `FrameMetadataManager` (non-E2EE) or by the E2EE FrameCryptor worker
|
|
15539
15576
|
* after decryption (E2EE).
|
|
15540
15577
|
*
|
|
15541
15578
|
* @experimental
|
|
15542
15579
|
*/
|
|
15543
|
-
class
|
|
15580
|
+
class FrameMetadataExtractor {
|
|
15544
15581
|
constructor() {
|
|
15545
15582
|
this.metadataMap = new Map();
|
|
15546
15583
|
this.activeSsrc = 0;
|
|
@@ -15580,7 +15617,7 @@ class PacketTrailerExtractor {
|
|
|
15580
15617
|
*
|
|
15581
15618
|
* @experimental
|
|
15582
15619
|
*/
|
|
15583
|
-
class
|
|
15620
|
+
class FrameMetadataManager {
|
|
15584
15621
|
constructor(options) {
|
|
15585
15622
|
this.extractors = new Map();
|
|
15586
15623
|
/**
|
|
@@ -15600,7 +15637,7 @@ class PacketTrailerManager {
|
|
|
15600
15637
|
}
|
|
15601
15638
|
};
|
|
15602
15639
|
this.onWorkerError = ev => {
|
|
15603
|
-
livekitLogger.error('
|
|
15640
|
+
livekitLogger.error('frame metadata worker encountered an error:', {
|
|
15604
15641
|
error: ev.error
|
|
15605
15642
|
});
|
|
15606
15643
|
};
|
|
@@ -15646,16 +15683,16 @@ class PacketTrailerManager {
|
|
|
15646
15683
|
}
|
|
15647
15684
|
return;
|
|
15648
15685
|
}
|
|
15649
|
-
if (!
|
|
15686
|
+
if (!isFrameMetadataSupported(this.worker ? {
|
|
15650
15687
|
worker: this.worker
|
|
15651
15688
|
} : undefined) && !((_b = this.room) === null || _b === void 0 ? void 0 : _b.hasE2EESetup)) {
|
|
15652
|
-
livekitLogger.warn('
|
|
15689
|
+
livekitLogger.warn('frame metadata transform not supported; skipping extraction');
|
|
15653
15690
|
return;
|
|
15654
15691
|
}
|
|
15655
|
-
const extractor = new
|
|
15692
|
+
const extractor = new FrameMetadataExtractor();
|
|
15656
15693
|
const trackId = track.mediaStreamID;
|
|
15657
15694
|
this.extractors.set(trackId, extractor);
|
|
15658
|
-
track.
|
|
15695
|
+
track.frameMetadataExtractor = extractor;
|
|
15659
15696
|
if ((_c = this.room) === null || _c === void 0 ? void 0 : _c.hasE2EESetup) {
|
|
15660
15697
|
// E2EE worker strips the trailer and injects metadata directly into
|
|
15661
15698
|
// the extractor via E2eeManager; no pipeline is needed here.
|
|
@@ -15664,14 +15701,14 @@ class PacketTrailerManager {
|
|
|
15664
15701
|
this.setupWorkerReceiver(receiver, trackId, true);
|
|
15665
15702
|
}
|
|
15666
15703
|
setupPassthroughReceiver(receiver, trackId) {
|
|
15667
|
-
if (
|
|
15704
|
+
if (shouldUseFrameMetadataScriptTransform()) {
|
|
15668
15705
|
if ('transform' in receiver) {
|
|
15669
15706
|
// @ts-ignore
|
|
15670
15707
|
receiver.transform = null;
|
|
15671
15708
|
}
|
|
15672
15709
|
return;
|
|
15673
15710
|
}
|
|
15674
|
-
if (this.worker &&
|
|
15711
|
+
if (this.worker && isFrameMetadataSupported({
|
|
15675
15712
|
worker: this.worker
|
|
15676
15713
|
}) && !this.workerPipelines.has(receiver)) {
|
|
15677
15714
|
this.setupWorkerReceiver(receiver, trackId, false);
|
|
@@ -15687,7 +15724,7 @@ class PacketTrailerManager {
|
|
|
15687
15724
|
if (!worker) {
|
|
15688
15725
|
return;
|
|
15689
15726
|
}
|
|
15690
|
-
if (
|
|
15727
|
+
if (shouldUseFrameMetadataScriptTransform()) {
|
|
15691
15728
|
// @ts-ignore
|
|
15692
15729
|
receiver.transform = new RTCRtpScriptTransform(worker, {
|
|
15693
15730
|
kind: 'decode',
|
|
@@ -15746,7 +15783,7 @@ class PacketTrailerManager {
|
|
|
15746
15783
|
this.extractors.delete(trackId);
|
|
15747
15784
|
}
|
|
15748
15785
|
if (track instanceof RemoteVideoTrack) {
|
|
15749
|
-
track.
|
|
15786
|
+
track.frameMetadataExtractor = undefined;
|
|
15750
15787
|
}
|
|
15751
15788
|
// The receiver pipeline is intentionally left running. If the receiver is
|
|
15752
15789
|
// reused for a new track, `setupReceiver` will remap it. If the room
|
|
@@ -15763,7 +15800,9 @@ class PacketTrailerManager {
|
|
|
15763
15800
|
this.workerPipelines.clear();
|
|
15764
15801
|
(_a = this.worker) === null || _a === void 0 ? void 0 : _a.terminate();
|
|
15765
15802
|
}
|
|
15766
|
-
}
|
|
15803
|
+
}
|
|
15804
|
+
/** @deprecated Use {@link FrameMetadataManager} instead. */
|
|
15805
|
+
const PacketTrailerManager = FrameMetadataManager;const CONNECTION_BACKOFF_MIN_MS = 500;
|
|
15767
15806
|
const CONNECTION_BACKOFF_MAX_MS = 15000;
|
|
15768
15807
|
/**
|
|
15769
15808
|
* BackOffStrategy implements exponential backoff for connection failures.
|
|
@@ -16414,13 +16453,15 @@ class SignalClient {
|
|
|
16414
16453
|
if (redactedUrl.searchParams.has('access_token')) {
|
|
16415
16454
|
redactedUrl.searchParams.set('access_token', '<redacted>');
|
|
16416
16455
|
}
|
|
16456
|
+
if (this.ws) {
|
|
16457
|
+
const startClose = performance.now();
|
|
16458
|
+
yield this.close(false);
|
|
16459
|
+
this.log.debug("closed previous ws connection in ".concat(performance.now() - startClose, "ms"));
|
|
16460
|
+
}
|
|
16417
16461
|
this.log.info("signal connecting to ".concat(redactedUrl), {
|
|
16418
16462
|
reconnect: opts.reconnect,
|
|
16419
16463
|
reconnectReason: opts.reconnectReason
|
|
16420
16464
|
});
|
|
16421
|
-
if (this.ws) {
|
|
16422
|
-
yield this.close(false);
|
|
16423
|
-
}
|
|
16424
16465
|
this.ws = new WebSocketStream(rtcUrl);
|
|
16425
16466
|
try {
|
|
16426
16467
|
this.ws.closed.then(closeInfo => {
|
|
@@ -18212,6 +18253,15 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
|
18212
18253
|
});
|
|
18213
18254
|
}
|
|
18214
18255
|
});
|
|
18256
|
+
// The server's answer sets per-track codec params (e.g. opus `usedtx`) on
|
|
18257
|
+
// the sections mapped to a published track, but leaves the pre-populated
|
|
18258
|
+
// recvonly placeholder sections with defaults. Conform the placeholders so
|
|
18259
|
+
// each shared payload type is consistent across the bundle, otherwise
|
|
18260
|
+
// libwebrtc flags a "bundled payload type collision".
|
|
18261
|
+
const placeholderMids = this.getPlaceholderMids();
|
|
18262
|
+
if (placeholderMids.size > 0) {
|
|
18263
|
+
conformBundledCodecFmtp(sdpParsed.media, media => placeholderMids.has(getMidString(media.mid)));
|
|
18264
|
+
}
|
|
18215
18265
|
mungedSDP = libExports.write(sdpParsed);
|
|
18216
18266
|
}
|
|
18217
18267
|
yield this.setMungedSDP(sd, mungedSDP, true);
|
|
@@ -18356,6 +18406,15 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
|
18356
18406
|
});
|
|
18357
18407
|
}
|
|
18358
18408
|
});
|
|
18409
|
+
// Conform the placeholder sections (pre-populated, or reverted after an
|
|
18410
|
+
// unpublish) so every shared payload type carries identical fmtp across the
|
|
18411
|
+
// bundle, otherwise libwebrtc flags a "bundled payload type collision".
|
|
18412
|
+
// Detection is by transceiver (mids are stable across renegotiations) since
|
|
18413
|
+
// an unpublished section keeps its `a=msid`.
|
|
18414
|
+
const placeholderMids = this.getPlaceholderMids();
|
|
18415
|
+
if (placeholderMids.size > 0) {
|
|
18416
|
+
conformBundledCodecFmtp(sdpParsed.media, media => placeholderMids.has(getMidString(media.mid)));
|
|
18417
|
+
}
|
|
18359
18418
|
if (this.latestOfferId > offerId) {
|
|
18360
18419
|
this.log.warn('latestOfferId mismatch', Object.assign(Object.assign({}, this.logContext), {
|
|
18361
18420
|
latestOfferId: this.latestOfferId,
|
|
@@ -18385,6 +18444,17 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
|
18385
18444
|
return answer;
|
|
18386
18445
|
});
|
|
18387
18446
|
}
|
|
18447
|
+
/**
|
|
18448
|
+
* Returns the mids of transceivers that carry no outgoing track on this
|
|
18449
|
+
* (publisher) connection: the pre-populated placeholders added by
|
|
18450
|
+
* `RTCEngine.applyInitialPublisherLayout`, plus any transceiver that was used
|
|
18451
|
+
* for a track and reverted on unpublish. Their codec fmtp is conformed to the
|
|
18452
|
+
* published tracks so a shared payload type stays consistent across the bundle.
|
|
18453
|
+
*/
|
|
18454
|
+
getPlaceholderMids() {
|
|
18455
|
+
var _a, _b;
|
|
18456
|
+
return placeholderMidsFromTransceivers((_b = (_a = this._pc) === null || _a === void 0 ? void 0 : _a.getTransceivers()) !== null && _b !== void 0 ? _b : []);
|
|
18457
|
+
}
|
|
18388
18458
|
createDataChannel(label, dataChannelDict) {
|
|
18389
18459
|
return this.pc.createDataChannel(label, dataChannelDict);
|
|
18390
18460
|
}
|
|
@@ -18449,6 +18519,10 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
|
18449
18519
|
getStats() {
|
|
18450
18520
|
return this.pc.getStats();
|
|
18451
18521
|
}
|
|
18522
|
+
getMaxMessageSize() {
|
|
18523
|
+
var _a, _b;
|
|
18524
|
+
return (_b = (_a = this._pc) === null || _a === void 0 ? void 0 : _a.sctp) === null || _b === void 0 ? void 0 : _b.maxMessageSize;
|
|
18525
|
+
}
|
|
18452
18526
|
getConnectedAddress() {
|
|
18453
18527
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18454
18528
|
var _a;
|
|
@@ -18603,6 +18677,79 @@ function ensureAudioNackAndStereo(media, stereoMids, nackMids) {
|
|
|
18603
18677
|
}
|
|
18604
18678
|
}
|
|
18605
18679
|
}
|
|
18680
|
+
/**
|
|
18681
|
+
* Returns the mids of transceivers that carry no outgoing track: the
|
|
18682
|
+
* pre-populated placeholders added by `RTCEngine.applyInitialPublisherLayout`,
|
|
18683
|
+
* plus any transceiver that was used for a track and reverted on unpublish. The
|
|
18684
|
+
* `sender.track` check is the reliable signal — an unpublished section keeps its
|
|
18685
|
+
* `a=msid` (and its stale send-derived fmtp), so it can't be told apart from a
|
|
18686
|
+
* real send by SDP alone. Transceiver mids are stable across renegotiations, so
|
|
18687
|
+
* this works for every offer/answer after the first.
|
|
18688
|
+
* @internal
|
|
18689
|
+
*/
|
|
18690
|
+
function placeholderMidsFromTransceivers(transceivers) {
|
|
18691
|
+
const mids = new Set();
|
|
18692
|
+
for (const transceiver of transceivers) {
|
|
18693
|
+
if (transceiver.mid && !transceiver.sender.track) {
|
|
18694
|
+
mids.add(transceiver.mid);
|
|
18695
|
+
}
|
|
18696
|
+
}
|
|
18697
|
+
return mids;
|
|
18698
|
+
}
|
|
18699
|
+
/**
|
|
18700
|
+
* Within a BUNDLE group a payload type must map to identical codec parameters
|
|
18701
|
+
* across every m-line. When the same payload type carries different fmtp between
|
|
18702
|
+
* sections — e.g. opus `usedtx=1` on the published microphone but not on the
|
|
18703
|
+
* pre-populated recvonly placeholders, or H.265 with different `level-id` between
|
|
18704
|
+
* a published video track and a placeholder — libwebrtc flags a "bundled payload
|
|
18705
|
+
* type collision".
|
|
18706
|
+
*
|
|
18707
|
+
* Rewrite the placeholder sections so every shared payload type carries the
|
|
18708
|
+
* same fmtp. Real (non-placeholder) sections always win the canonical value, so
|
|
18709
|
+
* a published track's encoder parameters are never altered. When no real
|
|
18710
|
+
* section declares a payload type — e.g. a placeholder that was reused for a
|
|
18711
|
+
* track and then reverted to recvonly keeps its send-derived `level-id` while
|
|
18712
|
+
* fresh placeholders use the default — the placeholders still converge on the
|
|
18713
|
+
* first value seen, so two placeholders can't disagree either. Only placeholder
|
|
18714
|
+
* sections are ever rewritten, and it is codec-agnostic (opus, H.265, ...).
|
|
18715
|
+
* `isPlaceholder` identifies the sections to conform.
|
|
18716
|
+
* @internal
|
|
18717
|
+
*/
|
|
18718
|
+
function conformBundledCodecFmtp(media, isPlaceholder) {
|
|
18719
|
+
var _a, _b;
|
|
18720
|
+
// Canonical fmtp per payload type. Payload types are unique within a BUNDLE
|
|
18721
|
+
// group, so keying by payload alone (across audio and video) is safe. A real
|
|
18722
|
+
// section's value always takes precedence; otherwise the first placeholder
|
|
18723
|
+
// value seen is used so divergent placeholders still converge.
|
|
18724
|
+
const canonicalByPayload = new Map();
|
|
18725
|
+
const fromRealSection = new Set();
|
|
18726
|
+
for (const m of media) {
|
|
18727
|
+
const placeholder = isPlaceholder(m);
|
|
18728
|
+
for (const fmtp of (_a = m.fmtp) !== null && _a !== void 0 ? _a : []) {
|
|
18729
|
+
if (!placeholder) {
|
|
18730
|
+
canonicalByPayload.set(fmtp.payload, fmtp.config);
|
|
18731
|
+
fromRealSection.add(fmtp.payload);
|
|
18732
|
+
} else if (!canonicalByPayload.has(fmtp.payload)) {
|
|
18733
|
+
canonicalByPayload.set(fmtp.payload, fmtp.config);
|
|
18734
|
+
}
|
|
18735
|
+
}
|
|
18736
|
+
}
|
|
18737
|
+
if (canonicalByPayload.size === 0) {
|
|
18738
|
+
return;
|
|
18739
|
+
}
|
|
18740
|
+
// Conform placeholder sections to the canonical fmtp for each shared payload.
|
|
18741
|
+
for (const m of media) {
|
|
18742
|
+
if (!isPlaceholder(m)) {
|
|
18743
|
+
continue;
|
|
18744
|
+
}
|
|
18745
|
+
for (const fmtp of (_b = m.fmtp) !== null && _b !== void 0 ? _b : []) {
|
|
18746
|
+
const config = canonicalByPayload.get(fmtp.payload);
|
|
18747
|
+
if (config !== undefined && fmtp.config !== config) {
|
|
18748
|
+
fmtp.config = config;
|
|
18749
|
+
}
|
|
18750
|
+
}
|
|
18751
|
+
}
|
|
18752
|
+
}
|
|
18606
18753
|
function extractStereoAndNackAudioFromOffer(offer) {
|
|
18607
18754
|
var _a;
|
|
18608
18755
|
const stereoMids = [];
|
|
@@ -18960,6 +19107,9 @@ class PCTransportManager {
|
|
|
18960
19107
|
const matchingTransceiver = transceivers.find(transceiver => transceiver.receiver === receiver);
|
|
18961
19108
|
return matchingTransceiver === null || matchingTransceiver === void 0 ? void 0 : matchingTransceiver.mid;
|
|
18962
19109
|
}
|
|
19110
|
+
getMaxPublisherMessageSize() {
|
|
19111
|
+
return this.publisher.getMaxMessageSize();
|
|
19112
|
+
}
|
|
18963
19113
|
addPublisherTrack(track) {
|
|
18964
19114
|
return this.publisher.addTrack(track);
|
|
18965
19115
|
}
|
|
@@ -20231,7 +20381,10 @@ function encodingsFromPresets(width, height, presets, sourceFramerate) {
|
|
|
20231
20381
|
/** @internal */
|
|
20232
20382
|
function sortPresets(presets) {
|
|
20233
20383
|
if (!presets) return;
|
|
20234
|
-
|
|
20384
|
+
// Sort a copy so we don't mutate the caller's array in place. Mutating the
|
|
20385
|
+
// passed-in simulcast layers can cause consumers that compare options by value
|
|
20386
|
+
// (e.g. components-react's useLiveKitRoom) to detect a spurious change.
|
|
20387
|
+
return presets.slice().sort((a, b) => {
|
|
20235
20388
|
const aEnc = a.encoding;
|
|
20236
20389
|
const bEnc = b.encoding;
|
|
20237
20390
|
if (aEnc.maxBitrate > bEnc.maxBitrate) {
|
|
@@ -21060,6 +21213,10 @@ var DataChannelKind;
|
|
|
21060
21213
|
DataChannelKind[DataChannelKind["LOSSY"] = 1] = "LOSSY";
|
|
21061
21214
|
DataChannelKind[DataChannelKind["DATA_TRACK_LOSSY"] = 2] = "DATA_TRACK_LOSSY";
|
|
21062
21215
|
})(DataChannelKind || (DataChannelKind = {}));
|
|
21216
|
+
// Default data-channel max message size (bytes), used when the remote SDP
|
|
21217
|
+
// answer does not advertise an `a=max-message-size` attribute (RFC 8841).
|
|
21218
|
+
// `0` means "no limit".
|
|
21219
|
+
const DEFAULT_MAX_MESSAGE_SIZE = 64000;
|
|
21063
21220
|
/** @internal */
|
|
21064
21221
|
class RTCEngine extends eventsExports.EventEmitter {
|
|
21065
21222
|
get isClosed() {
|
|
@@ -21204,12 +21361,21 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21204
21361
|
this.emit('dataTrackPacketReceived', new Uint8Array(buffer));
|
|
21205
21362
|
});
|
|
21206
21363
|
this.handleDataError = event => {
|
|
21364
|
+
// Errors fired while we're tearing the connection down (e.g. the SCTP transport aborting as
|
|
21365
|
+
// the peer connection closes) carry no actionable information — the channel is going away
|
|
21366
|
+
// regardless. Suppress them so a graceful disconnect doesn't surface spurious errors.
|
|
21367
|
+
// See livekit/client-sdk-js#1953.
|
|
21368
|
+
if (this._isClosed) {
|
|
21369
|
+
return;
|
|
21370
|
+
}
|
|
21207
21371
|
const channel = event.currentTarget;
|
|
21208
21372
|
const channelKind = channel.maxRetransmits === 0 ? 'lossy' : 'reliable';
|
|
21209
|
-
if (event instanceof
|
|
21210
|
-
const error = event.error
|
|
21211
|
-
this.log.error("DataChannel error on ".concat(channelKind, ": ").concat(
|
|
21212
|
-
error
|
|
21373
|
+
if (typeof RTCErrorEvent !== 'undefined' && event instanceof RTCErrorEvent && event.error) {
|
|
21374
|
+
const error = event.error;
|
|
21375
|
+
this.log.error("DataChannel error on ".concat(channelKind, ": ").concat(error.message), {
|
|
21376
|
+
error,
|
|
21377
|
+
errorDetail: error.errorDetail,
|
|
21378
|
+
sctpCauseCode: error.sctpCauseCode
|
|
21213
21379
|
});
|
|
21214
21380
|
} else {
|
|
21215
21381
|
this.log.error("Unknown DataChannel error on ".concat(channelKind), {
|
|
@@ -21217,6 +21383,15 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21217
21383
|
});
|
|
21218
21384
|
}
|
|
21219
21385
|
};
|
|
21386
|
+
this.handleDataChannelClose = kind => () => {
|
|
21387
|
+
var _a;
|
|
21388
|
+
// A publisher DC closing while the session is up and the publisher PC is still
|
|
21389
|
+
// connected is the signature of an oversized message having aborted the channel
|
|
21390
|
+
// (see livekit/rust-sdks#1137). Surface it; do not attempt renegotiation.
|
|
21391
|
+
if (!this._isClosed && ((_a = this.pcManager) === null || _a === void 0 ? void 0 : _a.publisher.getConnectionState()) === 'connected') {
|
|
21392
|
+
this.log.error("publisher data channel '".concat(DataChannelKind[kind], "' closed unexpectedly"), this.logContext);
|
|
21393
|
+
}
|
|
21394
|
+
};
|
|
21220
21395
|
this.handleBufferedAmountLow = channelKind => {
|
|
21221
21396
|
this.updateAndEmitDCBufferStatus(channelKind);
|
|
21222
21397
|
};
|
|
@@ -21516,17 +21691,23 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21516
21691
|
cleanupPeerConnections() {
|
|
21517
21692
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21518
21693
|
var _a;
|
|
21519
|
-
yield (_a = this.pcManager) === null || _a === void 0 ? void 0 : _a.close();
|
|
21520
|
-
this.pcManager = undefined;
|
|
21521
21694
|
const dcCleanup = dc => {
|
|
21522
|
-
if (!dc)
|
|
21523
|
-
|
|
21695
|
+
if (!dc) {
|
|
21696
|
+
return;
|
|
21697
|
+
}
|
|
21698
|
+
// Detach the data channel handlers before closing anything. Closing a peer connection tears
|
|
21699
|
+
// down the SCTP transport, which can dispatch `error`/`close` events on the still-open data
|
|
21700
|
+
// channels; if our handlers are still attached at that point, handleDataError logs a spurious
|
|
21701
|
+
// "Unknown DataChannel error" during an otherwise graceful disconnect. Removing the handlers
|
|
21702
|
+
// before dc.close()/pcManager.close() makes this deterministic regardless of how/when the
|
|
21703
|
+
// browser dispatches those teardown events. See livekit/client-sdk-js#1953.
|
|
21524
21704
|
dc.onbufferedamountlow = null;
|
|
21525
21705
|
dc.onclose = null;
|
|
21526
21706
|
dc.onclosing = null;
|
|
21527
21707
|
dc.onerror = null;
|
|
21528
21708
|
dc.onmessage = null;
|
|
21529
21709
|
dc.onopen = null;
|
|
21710
|
+
dc.close();
|
|
21530
21711
|
};
|
|
21531
21712
|
dcCleanup(this.lossyDC);
|
|
21532
21713
|
dcCleanup(this.lossyDCSub);
|
|
@@ -21534,6 +21715,8 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21534
21715
|
dcCleanup(this.reliableDCSub);
|
|
21535
21716
|
dcCleanup(this.dataTrackDC);
|
|
21536
21717
|
dcCleanup(this.dataTrackDCSub);
|
|
21718
|
+
yield (_a = this.pcManager) === null || _a === void 0 ? void 0 : _a.close();
|
|
21719
|
+
this.pcManager = undefined;
|
|
21537
21720
|
this.lossyDC = undefined;
|
|
21538
21721
|
this.lossyDCSub = undefined;
|
|
21539
21722
|
this.reliableDC = undefined;
|
|
@@ -21806,12 +21989,12 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21806
21989
|
};
|
|
21807
21990
|
}
|
|
21808
21991
|
makeRTCConfiguration(serverResponse) {
|
|
21809
|
-
var _a
|
|
21992
|
+
var _a;
|
|
21810
21993
|
const rtcConfig = Object.assign({}, this.rtcConfig);
|
|
21811
21994
|
// E2EE and packet trailer extraction both rely on encoded frame transforms.
|
|
21812
21995
|
// Only opt into the createEncodedStreams flavor when that path will be
|
|
21813
21996
|
// used; RTCRtpScriptTransform does not need the PeerConnection flag.
|
|
21814
|
-
const needsInsertableStreams = ((_a = this.signalOpts) === null || _a === void 0 ? void 0 : _a.e2eeEnabled) ||
|
|
21997
|
+
const needsInsertableStreams = ((_a = this.signalOpts) === null || _a === void 0 ? void 0 : _a.e2eeEnabled) || this.frameMetadataWorker && !shouldUseFrameMetadataScriptTransform();
|
|
21815
21998
|
if (needsInsertableStreams && isInsertableStreamSupported()) {
|
|
21816
21999
|
this.log.debug('E2EE - setting up transports with insertable streams');
|
|
21817
22000
|
// this makes sure that no data is sent before the transforms are ready
|
|
@@ -21853,7 +22036,15 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21853
22036
|
*/
|
|
21854
22037
|
applyInitialPublisherLayout() {
|
|
21855
22038
|
this.createDataChannels();
|
|
21856
|
-
|
|
22039
|
+
/**
|
|
22040
|
+
* Native libwebrtc does not support pre-populating the media sections,
|
|
22041
|
+
* so we skip it for React Native.
|
|
22042
|
+
*
|
|
22043
|
+
* Related: https://github.com/livekit/rust-sdks/pull/1151
|
|
22044
|
+
*/
|
|
22045
|
+
if (!isReactNative()) {
|
|
22046
|
+
this.addMediaSections(initialMediaSectionsAudio, initialMediaSectionsVideo);
|
|
22047
|
+
}
|
|
21857
22048
|
}
|
|
21858
22049
|
addMediaSections(numAudios, numVideos) {
|
|
21859
22050
|
var _a, _b;
|
|
@@ -21875,14 +22066,17 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21875
22066
|
if (this.lossyDC) {
|
|
21876
22067
|
this.lossyDC.onmessage = null;
|
|
21877
22068
|
this.lossyDC.onerror = null;
|
|
22069
|
+
this.lossyDC.onclose = null;
|
|
21878
22070
|
}
|
|
21879
22071
|
if (this.reliableDC) {
|
|
21880
22072
|
this.reliableDC.onmessage = null;
|
|
21881
22073
|
this.reliableDC.onerror = null;
|
|
22074
|
+
this.reliableDC.onclose = null;
|
|
21882
22075
|
}
|
|
21883
22076
|
if (this.dataTrackDC) {
|
|
21884
22077
|
this.dataTrackDC.onmessage = null;
|
|
21885
22078
|
this.dataTrackDC.onerror = null;
|
|
22079
|
+
this.dataTrackDC.onclose = null;
|
|
21886
22080
|
}
|
|
21887
22081
|
// create data channels
|
|
21888
22082
|
this.lossyDC = this.pcManager.createPublisherDataChannel(lossyDataChannel, {
|
|
@@ -21904,6 +22098,10 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21904
22098
|
this.lossyDC.onerror = this.handleDataError;
|
|
21905
22099
|
this.reliableDC.onerror = this.handleDataError;
|
|
21906
22100
|
this.dataTrackDC.onerror = this.handleDataError;
|
|
22101
|
+
// detect unexpected publisher data channel closes
|
|
22102
|
+
this.lossyDC.onclose = this.handleDataChannelClose(DataChannelKind.LOSSY);
|
|
22103
|
+
this.reliableDC.onclose = this.handleDataChannelClose(DataChannelKind.RELIABLE);
|
|
22104
|
+
this.dataTrackDC.onclose = this.handleDataChannelClose(DataChannelKind.DATA_TRACK_LOSSY);
|
|
21907
22105
|
// set up dc buffer threshold, set to 64kB (otherwise 0 by default)
|
|
21908
22106
|
this.lossyDC.bufferedAmountLowThreshold = 65535;
|
|
21909
22107
|
this.reliableDC.bufferedAmountLowThreshold = 65535;
|
|
@@ -21935,7 +22133,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21935
22133
|
} else {
|
|
21936
22134
|
throw new UnexpectedConnectionState('Required webRTC APIs not supported on this device');
|
|
21937
22135
|
}
|
|
21938
|
-
this.
|
|
22136
|
+
this.setupFrameMetadataSender(sender, opts);
|
|
21939
22137
|
return sender;
|
|
21940
22138
|
});
|
|
21941
22139
|
}
|
|
@@ -21951,32 +22149,37 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21951
22149
|
throw new UnexpectedConnectionState('Cannot stream on this device');
|
|
21952
22150
|
}
|
|
21953
22151
|
if (sender) {
|
|
21954
|
-
this.
|
|
22152
|
+
this.setupFrameMetadataSender(sender, opts);
|
|
21955
22153
|
}
|
|
21956
22154
|
return sender;
|
|
21957
22155
|
});
|
|
21958
22156
|
}
|
|
21959
|
-
|
|
21960
|
-
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
22157
|
+
get frameMetadataWorker() {
|
|
21961
22158
|
var _a, _b;
|
|
21962
|
-
|
|
22159
|
+
return (_b = (_a = this.options.frameMetadata) !== null && _a !== void 0 ? _a : this.options.packetTrailer) === null || _b === void 0 ? void 0 : _b.worker;
|
|
22160
|
+
}
|
|
22161
|
+
setupFrameMetadataSender(sender) {
|
|
22162
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
22163
|
+
var _a, _b, _c;
|
|
22164
|
+
const worker = this.frameMetadataWorker;
|
|
22165
|
+
if (!worker || ((_a = this.signalOpts) === null || _a === void 0 ? void 0 : _a.e2eeEnabled)) {
|
|
21963
22166
|
return;
|
|
21964
22167
|
}
|
|
21965
|
-
const
|
|
21966
|
-
const
|
|
21967
|
-
if (
|
|
21968
|
-
if (
|
|
22168
|
+
const frameMetadata = (_b = opts.frameMetadata) !== null && _b !== void 0 ? _b : opts.packetTrailer;
|
|
22169
|
+
const hasMetadata = hasFrameMetadataPublishOptions(frameMetadata);
|
|
22170
|
+
if (shouldUseFrameMetadataScriptTransform()) {
|
|
22171
|
+
if (hasMetadata) {
|
|
21969
22172
|
// @ts-ignore
|
|
21970
|
-
sender.transform = new RTCRtpScriptTransform(
|
|
22173
|
+
sender.transform = new RTCRtpScriptTransform(worker, {
|
|
21971
22174
|
kind: 'encode',
|
|
21972
|
-
packetTrailer
|
|
22175
|
+
packetTrailer: frameMetadata
|
|
21973
22176
|
});
|
|
21974
22177
|
}
|
|
21975
22178
|
return;
|
|
21976
22179
|
}
|
|
21977
|
-
if (!
|
|
21978
|
-
if (
|
|
21979
|
-
this.log.warn('
|
|
22180
|
+
if (!isFrameMetadataSupported((_c = this.options.frameMetadata) !== null && _c !== void 0 ? _c : this.options.packetTrailer) || !('createEncodedStreams' in sender)) {
|
|
22181
|
+
if (hasMetadata) {
|
|
22182
|
+
this.log.warn('frame metadata transform not supported; skipping write', this.logContext);
|
|
21980
22183
|
}
|
|
21981
22184
|
return;
|
|
21982
22185
|
}
|
|
@@ -21984,13 +22187,13 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21984
22187
|
const _sender$createEncoded = sender.createEncodedStreams(),
|
|
21985
22188
|
readable = _sender$createEncoded.readable,
|
|
21986
22189
|
writable = _sender$createEncoded.writable;
|
|
21987
|
-
if (
|
|
21988
|
-
|
|
22190
|
+
if (hasMetadata) {
|
|
22191
|
+
worker.postMessage({
|
|
21989
22192
|
kind: 'encode',
|
|
21990
22193
|
data: {
|
|
21991
22194
|
readableStream: readable,
|
|
21992
22195
|
writableStream: writable,
|
|
21993
|
-
packetTrailer
|
|
22196
|
+
packetTrailer: frameMetadata
|
|
21994
22197
|
}
|
|
21995
22198
|
}, [readable, writable]);
|
|
21996
22199
|
} else {
|
|
@@ -22278,6 +22481,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22278
22481
|
/* @internal */
|
|
22279
22482
|
sendDataPacket(packet, kind) {
|
|
22280
22483
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22484
|
+
var _a, _b;
|
|
22281
22485
|
// make sure we do have a data connection
|
|
22282
22486
|
yield this.ensurePublisherConnected(kind);
|
|
22283
22487
|
if (this.e2eeManager && this.e2eeManager.isDataChannelEncryptionEnabled) {
|
|
@@ -22299,6 +22503,13 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22299
22503
|
this.reliableDataSequence += 1;
|
|
22300
22504
|
}
|
|
22301
22505
|
const msg = packet.toBinary();
|
|
22506
|
+
// Clamp to the SDK default - libwebrtc advertises larger (~256 KiB)
|
|
22507
|
+
// than LiveKit/pion can deliver end-to-end (~64 KiB), so we trust
|
|
22508
|
+
// the answer up untilthe built in ceiling.
|
|
22509
|
+
const maxPublisherMessageSizeBytes = Math.min((_b = (_a = this.pcManager) === null || _a === void 0 ? void 0 : _a.getMaxPublisherMessageSize()) !== null && _b !== void 0 ? _b : DEFAULT_MAX_MESSAGE_SIZE, DEFAULT_MAX_MESSAGE_SIZE);
|
|
22510
|
+
if (typeof maxPublisherMessageSizeBytes !== 'undefined' && maxPublisherMessageSizeBytes !== 0 /* 0 means "no limit" */ && msg.byteLength > maxPublisherMessageSizeBytes) {
|
|
22511
|
+
throw new PublishDataError("cannot publish data packet larger than ".concat(maxPublisherMessageSizeBytes, " bytes (got ").concat(msg.byteLength, ")"));
|
|
22512
|
+
}
|
|
22302
22513
|
switch (kind) {
|
|
22303
22514
|
case DataChannelKind.LOSSY:
|
|
22304
22515
|
case DataChannelKind.DATA_TRACK_LOSSY:
|
|
@@ -25978,7 +26189,7 @@ function truncateBytes(str, maxBytes) {
|
|
|
25978
26189
|
* ack/response state, and handling incoming ack/response packets.
|
|
25979
26190
|
* @internal
|
|
25980
26191
|
*/
|
|
25981
|
-
class RpcClientManager extends EventEmitter {
|
|
26192
|
+
class RpcClientManager extends eventsExports.EventEmitter {
|
|
25982
26193
|
constructor(log, outgoingDataStreamManager, getRemoteParticipantClientProtocol, getServerVersion) {
|
|
25983
26194
|
super();
|
|
25984
26195
|
this.pendingAcks = new Map();
|
|
@@ -26178,7 +26389,7 @@ class RpcClientManager extends EventEmitter {
|
|
|
26178
26389
|
* managing registered method handlers, and sending responses.
|
|
26179
26390
|
* @internal
|
|
26180
26391
|
*/
|
|
26181
|
-
class RpcServerManager extends EventEmitter {
|
|
26392
|
+
class RpcServerManager extends eventsExports.EventEmitter {
|
|
26182
26393
|
constructor(log, outgoingDataStreamManager, getRemoteParticipantClientProtocol) {
|
|
26183
26394
|
super();
|
|
26184
26395
|
this.rpcHandlers = new Map();
|
|
@@ -28140,7 +28351,7 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
28140
28351
|
if (isLocalAudioTrack(track) && track.hasPreConnectBuffer) {
|
|
28141
28352
|
audioFeatures.push(AudioTrackFeature.TF_PRECONNECT_BUFFER);
|
|
28142
28353
|
}
|
|
28143
|
-
const packetTrailerFeatures = this.
|
|
28354
|
+
const packetTrailerFeatures = this.normalizeRequestedFrameMetadataOptions(track, opts);
|
|
28144
28355
|
// create track publication from track
|
|
28145
28356
|
const req = new AddTrackRequest({
|
|
28146
28357
|
// get local track id for use during publishing
|
|
@@ -28436,21 +28647,28 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
28436
28647
|
return publication;
|
|
28437
28648
|
});
|
|
28438
28649
|
}
|
|
28439
|
-
|
|
28440
|
-
|
|
28650
|
+
canPublishFrameMetadata() {
|
|
28651
|
+
var _a;
|
|
28652
|
+
return !!(this.roomOptions.e2ee || this.roomOptions.encryption || isFrameMetadataSupported((_a = this.roomOptions.frameMetadata) !== null && _a !== void 0 ? _a : this.roomOptions.packetTrailer));
|
|
28441
28653
|
}
|
|
28442
|
-
|
|
28443
|
-
|
|
28654
|
+
normalizeRequestedFrameMetadataOptions(track, opts) {
|
|
28655
|
+
var _a;
|
|
28656
|
+
const fmOpts = (_a = opts.frameMetadata) !== null && _a !== void 0 ? _a : opts.packetTrailer;
|
|
28657
|
+
if (track.kind !== Track.Kind.Video || !hasFrameMetadataPublishOptions(fmOpts)) {
|
|
28658
|
+
opts.frameMetadata = undefined;
|
|
28444
28659
|
opts.packetTrailer = undefined;
|
|
28445
28660
|
return [];
|
|
28446
28661
|
}
|
|
28447
|
-
if (!this.
|
|
28448
|
-
this.log.warn('
|
|
28662
|
+
if (!this.canPublishFrameMetadata()) {
|
|
28663
|
+
this.log.warn('frame metadata transform not supported; not advertising features', Object.assign(Object.assign({}, this.logContext), getLogContextFromTrack(track)));
|
|
28664
|
+
opts.frameMetadata = undefined;
|
|
28449
28665
|
opts.packetTrailer = undefined;
|
|
28450
28666
|
return [];
|
|
28451
28667
|
}
|
|
28452
|
-
const features =
|
|
28453
|
-
|
|
28668
|
+
const features = getFrameMetadataFeatures(fmOpts);
|
|
28669
|
+
const normalized = getFrameMetadataPublishOptions(features);
|
|
28670
|
+
opts.frameMetadata = normalized;
|
|
28671
|
+
opts.packetTrailer = normalized;
|
|
28454
28672
|
return features;
|
|
28455
28673
|
}
|
|
28456
28674
|
get isLocal() {
|
|
@@ -28492,7 +28710,7 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
28492
28710
|
if (!simulcastTrack) {
|
|
28493
28711
|
return;
|
|
28494
28712
|
}
|
|
28495
|
-
const packetTrailerFeatures = this.
|
|
28713
|
+
const packetTrailerFeatures = this.normalizeRequestedFrameMetadataOptions(track, opts);
|
|
28496
28714
|
const req = new AddTrackRequest({
|
|
28497
28715
|
cid: simulcastTrack.mediaStreamTrack.id,
|
|
28498
28716
|
type: Track.kindToProto(track.kind),
|
|
@@ -29764,10 +29982,11 @@ class Room extends eventsExports.EventEmitter {
|
|
|
29764
29982
|
return this.connectFuture.promise;
|
|
29765
29983
|
});
|
|
29766
29984
|
this.connectSignal = (url, token, engine, connectOptions, roomOptions, abortController) => __awaiter(this, void 0, void 0, function* () {
|
|
29985
|
+
var _a;
|
|
29767
29986
|
const _yield$engine$join = yield engine.join(url, token, {
|
|
29768
29987
|
autoSubscribe: connectOptions.autoSubscribe,
|
|
29769
29988
|
adaptiveStream: typeof roomOptions.adaptiveStream === 'object' ? true : roomOptions.adaptiveStream,
|
|
29770
|
-
clientInfoCapabilities:
|
|
29989
|
+
clientInfoCapabilities: isFrameMetadataSupported((_a = roomOptions.frameMetadata) !== null && _a !== void 0 ? _a : roomOptions.packetTrailer) || !!this.e2eeManager ? [ClientInfo_Capability.CAP_PACKET_TRAILER] : undefined,
|
|
29771
29990
|
maxRetries: connectOptions.maxRetries,
|
|
29772
29991
|
e2eeEnabled: !!this.e2eeManager,
|
|
29773
29992
|
websocketTimeout: connectOptions.websocketTimeout
|
|
@@ -30454,7 +30673,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30454
30673
|
});
|
|
30455
30674
|
this.disconnectLock = new _();
|
|
30456
30675
|
this.localParticipant = new LocalParticipant('', '', this.engine, this.options, this.outgoingDataStreamManager, this.outgoingDataTrackManager, this.rpcClientManager, this.rpcServerManager);
|
|
30457
|
-
this.
|
|
30676
|
+
this.setupFrameMetadata();
|
|
30458
30677
|
if (this.options.e2ee || this.options.encryption) {
|
|
30459
30678
|
this.setupE2EE();
|
|
30460
30679
|
}
|
|
@@ -30596,11 +30815,11 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30596
30815
|
(_b = this.e2eeManager) === null || _b === void 0 ? void 0 : _b.setupEngine(this.engine);
|
|
30597
30816
|
}
|
|
30598
30817
|
}
|
|
30599
|
-
|
|
30600
|
-
|
|
30601
|
-
|
|
30602
|
-
this.
|
|
30603
|
-
this.
|
|
30818
|
+
setupFrameMetadata() {
|
|
30819
|
+
var _a;
|
|
30820
|
+
const opts = (_a = this.options.frameMetadata) !== null && _a !== void 0 ? _a : this.options.packetTrailer;
|
|
30821
|
+
this.frameMetadataManager = new FrameMetadataManager(opts);
|
|
30822
|
+
this.frameMetadataManager.setup(this);
|
|
30604
30823
|
}
|
|
30605
30824
|
get logContext() {
|
|
30606
30825
|
var _a, _b, _c;
|
|
@@ -32784,6 +33003,7 @@ function areTokenSourceFetchOptionsEqual(a, b) {
|
|
|
32784
33003
|
case 'participantAttributes':
|
|
32785
33004
|
case 'agentName':
|
|
32786
33005
|
case 'agentMetadata':
|
|
33006
|
+
case 'deployment':
|
|
32787
33007
|
if (a[key] !== b[key]) {
|
|
32788
33008
|
return false;
|
|
32789
33009
|
}
|
|
@@ -32808,26 +33028,7 @@ class TokenSourceCached extends TokenSourceConfigurable {
|
|
|
32808
33028
|
if (!this.cachedFetchOptions) {
|
|
32809
33029
|
return false;
|
|
32810
33030
|
}
|
|
32811
|
-
|
|
32812
|
-
switch (key) {
|
|
32813
|
-
case 'roomName':
|
|
32814
|
-
case 'participantName':
|
|
32815
|
-
case 'participantIdentity':
|
|
32816
|
-
case 'participantMetadata':
|
|
32817
|
-
case 'participantAttributes':
|
|
32818
|
-
case 'agentName':
|
|
32819
|
-
case 'agentMetadata':
|
|
32820
|
-
if (this.cachedFetchOptions[key] !== options[key]) {
|
|
32821
|
-
return false;
|
|
32822
|
-
}
|
|
32823
|
-
break;
|
|
32824
|
-
default:
|
|
32825
|
-
// ref: https://stackoverflow.com/a/58009992
|
|
32826
|
-
const exhaustiveCheckedKey = key;
|
|
32827
|
-
throw new Error("Options key ".concat(exhaustiveCheckedKey, " not being checked for equality!"));
|
|
32828
|
-
}
|
|
32829
|
-
}
|
|
32830
|
-
return true;
|
|
33031
|
+
return areTokenSourceFetchOptionsEqual(options, this.cachedFetchOptions);
|
|
32831
33032
|
}
|
|
32832
33033
|
shouldReturnCachedValueFromFetch(fetchOptions) {
|
|
32833
33034
|
if (!this.cachedResponse) {
|
|
@@ -32912,7 +33113,7 @@ class TokenSourceEndpoint extends TokenSourceCached {
|
|
|
32912
33113
|
this.endpointOptions = options;
|
|
32913
33114
|
}
|
|
32914
33115
|
createRequestFromOptions(options) {
|
|
32915
|
-
var _a, _b, _c;
|
|
33116
|
+
var _a, _b, _c, _d;
|
|
32916
33117
|
const request = new TokenSourceRequest();
|
|
32917
33118
|
for (const key of Object.keys(options)) {
|
|
32918
33119
|
switch (key) {
|
|
@@ -32939,6 +33140,13 @@ class TokenSourceEndpoint extends TokenSourceCached {
|
|
|
32939
33140
|
}
|
|
32940
33141
|
request.roomConfig.agents[0].metadata = options.agentMetadata;
|
|
32941
33142
|
break;
|
|
33143
|
+
case 'deployment':
|
|
33144
|
+
request.roomConfig = (_d = request.roomConfig) !== null && _d !== void 0 ? _d : new RoomConfiguration();
|
|
33145
|
+
if (request.roomConfig.agents.length === 0) {
|
|
33146
|
+
request.roomConfig.agents.push(new RoomAgentDispatch());
|
|
33147
|
+
}
|
|
33148
|
+
request.roomConfig.agents[0].deployment = options.deployment;
|
|
33149
|
+
break;
|
|
32942
33150
|
default:
|
|
32943
33151
|
// ref: https://stackoverflow.com/a/58009992
|
|
32944
33152
|
const exhaustiveCheckedKey = key;
|
|
@@ -33147,4 +33355,4 @@ const serializers = {
|
|
|
33147
33355
|
json,
|
|
33148
33356
|
raw,
|
|
33149
33357
|
custom
|
|
33150
|
-
};export{AudioPresets,BackupCodecPolicy,BaseKeyProvider,CLIENT_PROTOCOL_DATA_STREAM_RPC,CLIENT_PROTOCOL_DEFAULT,CheckStatus,Checker,ConnectionCheck,ConnectionError,ConnectionErrorReason,ConnectionQuality,ConnectionState,CriticalTimers,CryptorError,CryptorErrorReason,CryptorEvent,DataPacket_Kind,DataStreamError,DataStreamErrorReason,DataTrackPacket,DefaultReconnectPolicy,DeviceUnsupportedError,DisconnectReason,EncryptionEvent,Encryption_Type,EngineEvent,ExternalE2EEKeyProvider,KeyHandlerEvent,KeyProviderEvent,LivekitError,LivekitReasonedError,LocalAudioTrack,LocalDataTrack,LocalParticipant,LocalTrack,LocalTrackPublication,LocalTrackRecorder,LocalVideoTrack,LogLevel,LoggerNames,MediaDeviceFailure,_ as Mutex,NegotiationError,PacketTrailerManager,Participant,ParticipantEvent,ParticipantInfo_Kind as ParticipantKind,PublishDataError,PublishTrackError,RemoteAudioTrack,RemoteDataTrack,RemoteParticipant,RemoteTrack,RemoteTrackPublication,RemoteVideoTrack,Room,RoomEvent,RpcError,ScreenSharePresets,SignalReconnectError,SignalRequestError,SimulatedError,SubscriptionError,TokenSource,TokenSourceConfigurable,TokenSourceFixed,Track,TrackEvent,TrackInvalidError,TrackPublication,TrackType,UnexpectedConnectionState,UnsupportedServer,VideoPreset,VideoPresets,VideoPresets43,VideoQuality,areTokenSourceFetchOptionsEqual,asEncryptablePacket,attachToElement,attributeTypings as attributes,audioCodecs,clientProtocol,compareVersions,createAudioAnalyser,createE2EEKey,createKeyMaterialFromBuffer,createKeyMaterialFromString,createLocalAudioTrack,createLocalScreenTracks,createLocalTracks,createLocalVideoTrack,decodeTokenPayload,deriveKeys,detachTrack,facingModeFromDeviceLabel,facingModeFromLocalTrack,getBrowser,getEmptyAudioStreamTrack,getEmptyVideoStreamTrack,getLogger,importKey,isAudioCodec,isAudioTrack,isBackupCodec,isBackupVideoCodec,isBrowserSupported,isE2EESupported,isInsertableStreamSupported,isLocalParticipant,isLocalTrack,isRemoteParticipant,isRemoteTrack,isScriptTransformSupported,isSerializer,isVideoCodec,isVideoFrame,isVideoTrack,needsRbspUnescaping,parseRbsp,protocolVersion,ratchet,serializers,setLogExtension,setLogLevel,supportsAV1,supportsAdaptiveStream,supportsAudioOutputSelection,supportsDynacast,supportsVP9,version,videoCodecs,writeRbsp};//# sourceMappingURL=livekit-client.esm.mjs.map
|
|
33358
|
+
};export{AudioPresets,BackupCodecPolicy,BaseKeyProvider,CLIENT_PROTOCOL_DATA_STREAM_RPC,CLIENT_PROTOCOL_DEFAULT,CheckStatus,Checker,ConnectionCheck,ConnectionError,ConnectionErrorReason,ConnectionQuality,ConnectionState,CriticalTimers,CryptorError,CryptorErrorReason,CryptorEvent,DataPacket_Kind,DataStreamError,DataStreamErrorReason,DataTrackPacket,DefaultReconnectPolicy,DeviceUnsupportedError,DisconnectReason,EncryptionEvent,Encryption_Type,EngineEvent,ExternalE2EEKeyProvider,FrameMetadataManager,KeyHandlerEvent,KeyProviderEvent,LivekitError,LivekitReasonedError,LocalAudioTrack,LocalDataTrack,LocalParticipant,LocalTrack,LocalTrackPublication,LocalTrackRecorder,LocalVideoTrack,LogLevel,LoggerNames,MediaDeviceFailure,_ as Mutex,NegotiationError,PacketTrailerManager,Participant,ParticipantEvent,ParticipantInfo_Kind as ParticipantKind,PublishDataError,PublishTrackError,RemoteAudioTrack,RemoteDataTrack,RemoteParticipant,RemoteTrack,RemoteTrackPublication,RemoteVideoTrack,Room,RoomEvent,RpcError,ScreenSharePresets,SignalReconnectError,SignalRequestError,SimulatedError,SubscriptionError,TokenSource,TokenSourceConfigurable,TokenSourceFixed,Track,TrackEvent,TrackInvalidError,TrackPublication,TrackType,UnexpectedConnectionState,UnsupportedServer,VideoPreset,VideoPresets,VideoPresets43,VideoQuality,areTokenSourceFetchOptionsEqual,asEncryptablePacket,attachToElement,attributeTypings as attributes,audioCodecs,clientProtocol,compareVersions,createAudioAnalyser,createE2EEKey,createKeyMaterialFromBuffer,createKeyMaterialFromString,createLocalAudioTrack,createLocalScreenTracks,createLocalTracks,createLocalVideoTrack,decodeTokenPayload,deriveKeys,detachTrack,facingModeFromDeviceLabel,facingModeFromLocalTrack,getBrowser,getEmptyAudioStreamTrack,getEmptyVideoStreamTrack,getLogger,importKey,isAudioCodec,isAudioTrack,isBackupCodec,isBackupVideoCodec,isBrowserSupported,isE2EESupported,isInsertableStreamSupported,isLocalParticipant,isLocalTrack,isRemoteParticipant,isRemoteTrack,isScriptTransformSupported,isSerializer,isVideoCodec,isVideoFrame,isVideoTrack,needsRbspUnescaping,parseRbsp,protocolVersion,ratchet,serializers,setLogExtension,setLogLevel,supportsAV1,supportsAdaptiveStream,supportsAudioOutputSelection,supportsDynacast,supportsVP9,version,videoCodecs,writeRbsp};//# sourceMappingURL=livekit-client.esm.mjs.map
|