livekit-client 2.19.0 → 2.19.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.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +31 -10
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.pt.worker.js.map +1 -1
- package/dist/livekit-client.pt.worker.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.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/ts4.2/room/utils.d.ts +1 -0
- package/package.json +4 -2
- package/src/api/SignalClient.ts +1 -0
- package/src/room/RTCEngine.ts +4 -4
- package/src/room/Room.test.ts +99 -1
- package/src/room/Room.ts +24 -7
- package/src/room/utils.ts +5 -0
|
@@ -11793,7 +11793,7 @@ function getMatch(exp, ua) {
|
|
|
11793
11793
|
}
|
|
11794
11794
|
function getOSVersion(ua) {
|
|
11795
11795
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
|
11796
|
-
}var version$1 = "2.19.
|
|
11796
|
+
}var version$1 = "2.19.1";const version = version$1;
|
|
11797
11797
|
const protocolVersion = 17;
|
|
11798
11798
|
/** Initial client protocol. */
|
|
11799
11799
|
const CLIENT_PROTOCOL_DEFAULT = 0;
|
|
@@ -14039,6 +14039,10 @@ function extractMaxAgeFromRequestHeaders(headers) {
|
|
|
14039
14039
|
}
|
|
14040
14040
|
function isCompressionStreamSupported() {
|
|
14041
14041
|
return typeof CompressionStream !== 'undefined';
|
|
14042
|
+
}
|
|
14043
|
+
function isPublisherOfferWithJoinSupported() {
|
|
14044
|
+
// we have connectivity issue about publisher offer with join on firefox #1919
|
|
14045
|
+
return isCompressionStreamSupported() && !isFireFox();
|
|
14042
14046
|
}function createRtcUrl(url, searchParams) {
|
|
14043
14047
|
let useV0Path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14044
14048
|
const v0Url = createV0RtcUrl(url, searchParams);
|
|
@@ -17077,6 +17081,7 @@ function createConnectionParams(token, info, opts) {
|
|
|
17077
17081
|
params.set('sdk', isReactNative() ? 'reactnative' : 'js');
|
|
17078
17082
|
params.set('version', info.version);
|
|
17079
17083
|
params.set('protocol', info.protocol.toString());
|
|
17084
|
+
params.set('client_protocol', info.clientProtocol.toString());
|
|
17080
17085
|
if (info.deviceModel) {
|
|
17081
17086
|
params.set('device_model', info.deviceModel);
|
|
17082
17087
|
}
|
|
@@ -21355,7 +21360,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21355
21360
|
_this2.joinAttempts += 1;
|
|
21356
21361
|
_this2.setupSignalClientCallbacks();
|
|
21357
21362
|
let offerProto;
|
|
21358
|
-
if (!useV0Path &&
|
|
21363
|
+
if (!useV0Path && isPublisherOfferWithJoinSupported()) {
|
|
21359
21364
|
if (!_this2.pcManager) {
|
|
21360
21365
|
yield _this2.configure();
|
|
21361
21366
|
_this2.createDataChannels();
|
|
@@ -21378,7 +21383,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21378
21383
|
_this2.latestJoinResponse = joinResponse;
|
|
21379
21384
|
_this2.participantSid = (_b = joinResponse.participant) === null || _b === void 0 ? void 0 : _b.sid;
|
|
21380
21385
|
_this2.subscriberPrimary = joinResponse.subscriberPrimary;
|
|
21381
|
-
if (!useV0Path &&
|
|
21386
|
+
if (!useV0Path && isPublisherOfferWithJoinSupported()) {
|
|
21382
21387
|
(_c = _this2.pcManager) === null || _c === void 0 ? void 0 : _c.updateConfiguration(_this2.makeRTCConfiguration(joinResponse));
|
|
21383
21388
|
} else {
|
|
21384
21389
|
if (!_this2.pcManager) {
|
|
@@ -30370,16 +30375,32 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30370
30375
|
this.switchActiveDevice('audiooutput', unwrapConstraint(this.options.audioOutput.deviceId)).catch(e => this.log.warn("Could not set audio output: ".concat(e.message)));
|
|
30371
30376
|
}
|
|
30372
30377
|
if (isWeb()) {
|
|
30373
|
-
const
|
|
30374
|
-
|
|
30375
|
-
(_f = (_e = navigator.mediaDevices) === null || _e === void 0 ? void 0 : _e.addEventListener) === null || _f === void 0 ? void 0 : _f.call(_e, 'devicechange', this.handleDeviceChange, {
|
|
30376
|
-
signal: abortController.signal
|
|
30377
|
-
});
|
|
30378
|
+
const cleanupController = new AbortController();
|
|
30379
|
+
let onDeviceChange;
|
|
30378
30380
|
if (Room.cleanupRegistry) {
|
|
30381
|
+
// Wrap the listener in a WeakRef closure so navigator.mediaDevices does not
|
|
30382
|
+
// strongly retain the Room. When the user drops their Room ref, the
|
|
30383
|
+
// FinalizationRegistry callback aborts the controller and removes the listener.
|
|
30384
|
+
const roomRef = new WeakRef(this);
|
|
30385
|
+
onDeviceChange = () => {
|
|
30386
|
+
const self = roomRef.deref();
|
|
30387
|
+
if (!self) {
|
|
30388
|
+
return;
|
|
30389
|
+
}
|
|
30390
|
+
self.handleDeviceChange();
|
|
30391
|
+
};
|
|
30379
30392
|
Room.cleanupRegistry.register(this, () => {
|
|
30380
|
-
|
|
30393
|
+
cleanupController.abort();
|
|
30381
30394
|
});
|
|
30395
|
+
} else {
|
|
30396
|
+
// Legacy browsers without WeakRef/FinalizationRegistry: fall back to a
|
|
30397
|
+
// direct listener (matches pre-#1944 behavior).
|
|
30398
|
+
onDeviceChange = this.handleDeviceChange;
|
|
30382
30399
|
}
|
|
30400
|
+
// in order to catch device changes prior to room connection we need to register the event in the constructor
|
|
30401
|
+
(_f = (_e = navigator.mediaDevices) === null || _e === void 0 ? void 0 : _e.addEventListener) === null || _f === void 0 ? void 0 : _f.call(_e, 'devicechange', onDeviceChange, {
|
|
30402
|
+
signal: cleanupController.signal
|
|
30403
|
+
});
|
|
30383
30404
|
}
|
|
30384
30405
|
}
|
|
30385
30406
|
registerTextStreamHandler(topic, callback) {
|
|
@@ -31621,7 +31642,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
31621
31642
|
return super.emit(event, ...args);
|
|
31622
31643
|
}
|
|
31623
31644
|
}
|
|
31624
|
-
Room.cleanupRegistry = typeof FinalizationRegistry !== 'undefined' && new FinalizationRegistry(cleanup => {
|
|
31645
|
+
Room.cleanupRegistry = typeof FinalizationRegistry !== 'undefined' && typeof WeakRef !== 'undefined' && new FinalizationRegistry(cleanup => {
|
|
31625
31646
|
cleanup();
|
|
31626
31647
|
});
|
|
31627
31648
|
function mapArgs(args) {
|