@stream-io/video-client 0.0.41 → 0.0.42

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.0.42](https://github.com/GetStream/stream-video-js/compare/client0.0.41...client0.0.42) (2023-07-12)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Heuristic announcement of track mid ([#785](https://github.com/GetStream/stream-video-js/issues/785)) ([21c1da7](https://github.com/GetStream/stream-video-js/commit/21c1da74a7b1691ccea6cad360dd9e18fa357b2d))
11
+
5
12
  ### [0.0.41](https://github.com/GetStream/stream-video-js/compare/client0.0.40...client0.0.41) (2023-07-10)
6
13
 
7
14
 
@@ -6053,6 +6053,14 @@ class Publisher {
6053
6053
  [TrackType.SCREEN_SHARE_AUDIO]: undefined,
6054
6054
  [TrackType.UNSPECIFIED]: undefined,
6055
6055
  };
6056
+ /**
6057
+ * An array maintaining the order how transceivers were added to the peer connection.
6058
+ * This is needed because some browsers (Firefox) don't reliably report
6059
+ * trackId and `mid` parameters.
6060
+ *
6061
+ * @private
6062
+ */
6063
+ this.transceiverInitOrder = [];
6056
6064
  this.trackKindMapping = {
6057
6065
  [TrackType.AUDIO]: 'audio',
6058
6066
  [TrackType.VIDEO]: 'video',
@@ -6146,6 +6154,8 @@ class Publisher {
6146
6154
  : undefined,
6147
6155
  sendEncodings: videoEncodings,
6148
6156
  });
6157
+ this.logger('debug', `Added ${TrackType[trackType]} transceiver`);
6158
+ this.transceiverInitOrder.push(trackType);
6149
6159
  this.transceiverRegistry[trackType] = transceiver;
6150
6160
  if ('setCodecPreferences' in transceiver && codecPreferences) {
6151
6161
  this.logger('info', `Setting ${TrackType[trackType]} codec preferences`, codecPreferences);
@@ -6368,14 +6378,14 @@ class Publisher {
6368
6378
  this.getCurrentTrackInfos = (sdp) => {
6369
6379
  var _a;
6370
6380
  sdp = sdp || ((_a = this.pc.localDescription) === null || _a === void 0 ? void 0 : _a.sdp);
6371
- const extractMid = (defaultMid, track) => {
6381
+ const extractMid = (defaultMid, track, trackType) => {
6372
6382
  if (defaultMid)
6373
6383
  return defaultMid;
6374
6384
  if (!sdp) {
6375
6385
  this.logger('warn', 'No SDP found. Returning empty mid');
6376
6386
  return '';
6377
6387
  }
6378
- this.logger('warn', 'No mid found for track. Trying to find it from SDP');
6388
+ this.logger('debug', `No 'mid' found for track. Trying to find it from the Offer SDP`);
6379
6389
  const parsedSdp = SDP.parse(sdp);
6380
6390
  const media = parsedSdp.media.find((m) => {
6381
6391
  var _a, _b;
@@ -6384,7 +6394,12 @@ class Publisher {
6384
6394
  ((_b = (_a = m.msid) === null || _a === void 0 ? void 0 : _a.includes(track.id)) !== null && _b !== void 0 ? _b : true));
6385
6395
  });
6386
6396
  if (typeof (media === null || media === void 0 ? void 0 : media.mid) === 'undefined') {
6387
- this.logger('warn', `No mid found in SDP for track type ${track.kind} and id ${track.id}`);
6397
+ this.logger('debug', `No mid found in SDP for track type ${track.kind} and id ${track.id}. Attempting to find a heuristic mid`);
6398
+ const heuristicMid = this.transceiverInitOrder.indexOf(trackType);
6399
+ if (heuristicMid !== -1) {
6400
+ return String(heuristicMid);
6401
+ }
6402
+ this.logger('debug', 'No heuristic mid found. Returning empty mid');
6388
6403
  return '';
6389
6404
  }
6390
6405
  return String(media.mid);
@@ -6426,7 +6441,7 @@ class Publisher {
6426
6441
  trackId: track.id,
6427
6442
  layers: layers,
6428
6443
  trackType,
6429
- mid: extractMid(transceiver.mid, track),
6444
+ mid: extractMid(transceiver.mid, track, trackType),
6430
6445
  // FIXME OL: adjust these values
6431
6446
  stereo: false,
6432
6447
  dtx: TrackType.AUDIO === trackType && this.isDtxEnabled,
@@ -11753,7 +11768,7 @@ class StreamClient {
11753
11768
  };
11754
11769
  this.getUserAgent = () => {
11755
11770
  return (this.userAgent ||
11756
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.40"}`);
11771
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.41"}`);
11757
11772
  };
11758
11773
  this.setUserAgent = (userAgent) => {
11759
11774
  this.userAgent = userAgent;