livekit-client 1.9.5 → 1.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -14060,7 +14060,7 @@ function getMatch(exp, ua) {
14060
14060
  return match && match.length >= id && match[id] || '';
14061
14061
  }
14062
14062
 
14063
- var version$1 = "1.9.5";
14063
+ var version$1 = "1.9.6";
14064
14064
 
14065
14065
  const version = version$1;
14066
14066
  const protocolVersion = 9;
@@ -14350,10 +14350,12 @@ const getResizeObserver = () => {
14350
14350
  };
14351
14351
  let intersectionObserver = null;
14352
14352
  const getIntersectionObserver = () => {
14353
- if (!intersectionObserver) intersectionObserver = new IntersectionObserver(ioDispatchCallback, {
14354
- root: document,
14355
- rootMargin: '0px'
14356
- });
14353
+ if (!intersectionObserver) {
14354
+ intersectionObserver = new IntersectionObserver(ioDispatchCallback, {
14355
+ root: null,
14356
+ rootMargin: '0px'
14357
+ });
14358
+ }
14357
14359
  return intersectionObserver;
14358
14360
  };
14359
14361
  function getClientInfo() {
@@ -18219,7 +18221,7 @@ function computeBitrate(currentStats, prevStats) {
18219
18221
  return (bytesNow - bytesPrev) * 8 * 1000 / (currentStats.timestamp - prevStats.timestamp);
18220
18222
  }
18221
18223
 
18222
- const defaultDimensionsTimeout = 2 * 1000;
18224
+ const defaultDimensionsTimeout = 1000;
18223
18225
  class LocalTrack extends Track {
18224
18226
  /**
18225
18227
  *
@@ -20371,6 +20373,15 @@ class RemoteParticipant extends Participant {
20371
20373
  if (!publication) {
20372
20374
  return;
20373
20375
  }
20376
+ // also send unsubscribe, if track is actively subscribed
20377
+ const {
20378
+ track
20379
+ } = publication;
20380
+ if (track) {
20381
+ track.stop();
20382
+ publication.setTrack(undefined);
20383
+ }
20384
+ // remove track from maps only after unsubscribed has been fired
20374
20385
  this.tracks.delete(sid);
20375
20386
  // remove from the right type map
20376
20387
  switch (publication.kind) {
@@ -20381,14 +20392,6 @@ class RemoteParticipant extends Participant {
20381
20392
  this.videoTracks.delete(sid);
20382
20393
  break;
20383
20394
  }
20384
- // also send unsubscribe, if track is actively subscribed
20385
- const {
20386
- track
20387
- } = publication;
20388
- if (track) {
20389
- track.stop();
20390
- publication.setTrack(undefined);
20391
- }
20392
20395
  if (sendUnpublish) {
20393
20396
  this.emit(ParticipantEvent.TrackUnpublished, publication);
20394
20397
  }
@@ -21218,7 +21221,7 @@ class LocalParticipant extends Participant {
21218
21221
  });
21219
21222
  }
21220
21223
  publish(track, opts, options, isStereo) {
21221
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
21224
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
21222
21225
  return __awaiter(this, void 0, void 0, function* () {
21223
21226
  const existingTrackOfSource = Array.from(this.tracks.values()).find(publishedTrack => track instanceof LocalTrack && publishedTrack.source === track.source);
21224
21227
  if (existingTrackOfSource && track.source !== Track.Source.Unknown) {
@@ -21279,8 +21282,15 @@ class LocalParticipant extends Participant {
21279
21282
  try {
21280
21283
  dims = yield track.waitForDimensions();
21281
21284
  } catch (e) {
21285
+ // use defaults, it's quite painful for congestion control without simulcast
21286
+ // so using default dims according to publish settings
21287
+ const defaultRes = (_d = (_c = this.roomOptions.videoCaptureDefaults) === null || _c === void 0 ? void 0 : _c.resolution) !== null && _d !== void 0 ? _d : VideoPresets.h720.resolution;
21288
+ dims = {
21289
+ width: defaultRes.width,
21290
+ height: defaultRes.height
21291
+ };
21282
21292
  // log failure
21283
- livekitLogger.error('could not determine track dimensions');
21293
+ livekitLogger.error('could not determine track dimensions, using defaults', dims);
21284
21294
  }
21285
21295
  // width and height should be defined for video
21286
21296
  req.width = dims.width;
@@ -21289,7 +21299,7 @@ class LocalParticipant extends Participant {
21289
21299
  if (track instanceof LocalVideoTrack) {
21290
21300
  if (isSVCCodec(opts.videoCodec)) {
21291
21301
  // set scalabilityMode to 'L3T3' by default
21292
- opts.scalabilityMode = (_c = opts.scalabilityMode) !== null && _c !== void 0 ? _c : 'L3T3';
21302
+ opts.scalabilityMode = (_e = opts.scalabilityMode) !== null && _e !== void 0 ? _e : 'L3T3';
21293
21303
  }
21294
21304
  // set up backup
21295
21305
  if (opts.videoCodec && opts.backupCodec && opts.videoCodec !== opts.backupCodec.codec) {
@@ -21311,9 +21321,9 @@ class LocalParticipant extends Participant {
21311
21321
  req.layers = videoLayersFromEncodings(req.width, req.height, simEncodings !== null && simEncodings !== void 0 ? simEncodings : encodings);
21312
21322
  } else if (track.kind === Track.Kind.Audio) {
21313
21323
  encodings = [{
21314
- maxBitrate: (_e = (_d = opts.audioPreset) === null || _d === void 0 ? void 0 : _d.maxBitrate) !== null && _e !== void 0 ? _e : opts.audioBitrate,
21315
- priority: (_g = (_f = opts.audioPreset) === null || _f === void 0 ? void 0 : _f.priority) !== null && _g !== void 0 ? _g : 'high',
21316
- networkPriority: (_j = (_h = opts.audioPreset) === null || _h === void 0 ? void 0 : _h.priority) !== null && _j !== void 0 ? _j : 'high'
21324
+ maxBitrate: (_g = (_f = opts.audioPreset) === null || _f === void 0 ? void 0 : _f.maxBitrate) !== null && _g !== void 0 ? _g : opts.audioBitrate,
21325
+ priority: (_j = (_h = opts.audioPreset) === null || _h === void 0 ? void 0 : _h.priority) !== null && _j !== void 0 ? _j : 'high',
21326
+ networkPriority: (_l = (_k = opts.audioPreset) === null || _k === void 0 ? void 0 : _k.priority) !== null && _l !== void 0 ? _l : 'high'
21317
21327
  }];
21318
21328
  }
21319
21329
  if (!this.engine || this.engine.isClosed) {
@@ -21355,7 +21365,7 @@ class LocalParticipant extends Participant {
21355
21365
  });
21356
21366
  // store RTPSender
21357
21367
  track.sender = yield this.engine.createSender(track, opts, encodings);
21358
- if (track.codec && isSVCCodec(track.codec) && encodings && ((_k = encodings[0]) === null || _k === void 0 ? void 0 : _k.maxBitrate)) {
21368
+ if (track.codec && isSVCCodec(track.codec) && encodings && ((_m = encodings[0]) === null || _m === void 0 ? void 0 : _m.maxBitrate)) {
21359
21369
  this.engine.publisher.setTrackCodecBitrate(req.cid, track.codec, encodings[0].maxBitrate / 1000);
21360
21370
  }
21361
21371
  this.engine.negotiate();