@stream-io/video-client 0.0.40 → 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 +14 -0
- package/dist/index.browser.es.js +38 -12
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +38 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +38 -12
- package/dist/index.es.js.map +1 -1
- package/dist/src/events/internal.d.ts +1 -0
- package/dist/src/rtc/Publisher.d.ts +8 -0
- package/package.json +1 -1
- package/src/StreamSfuClient.ts +1 -1
- package/src/StreamVideoClient.ts +4 -1
- package/src/events/callEventHandlers.ts +2 -0
- package/src/events/internal.ts +15 -0
- package/src/rtc/Publisher.ts +28 -7
- package/src/rtc/Subscriber.ts +1 -1
- package/src/stats/state-store-stats-reporter.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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
|
+
|
|
12
|
+
### [0.0.41](https://github.com/GetStream/stream-video-js/compare/client0.0.40...client0.0.41) (2023-07-10)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
* **react-sdk:** add token snippet to audio rooms tutorial ([#739](https://github.com/GetStream/stream-video-js/issues/739)) ([bf0b46c](https://github.com/GetStream/stream-video-js/commit/bf0b46ce40329458ad545c82b70a4099c4afc8f2))
|
|
18
|
+
|
|
5
19
|
### [0.0.40](https://github.com/GetStream/stream-video-js/compare/client0.0.39...client0.0.40) (2023-07-07)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -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);
|
|
@@ -6280,7 +6290,7 @@ class Publisher {
|
|
|
6280
6290
|
this.onIceCandidate = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
6281
6291
|
const { candidate } = e;
|
|
6282
6292
|
if (!candidate) {
|
|
6283
|
-
this.logger('
|
|
6293
|
+
this.logger('debug', 'null ice candidate');
|
|
6284
6294
|
return;
|
|
6285
6295
|
}
|
|
6286
6296
|
yield this.sfuClient.iceTrickle({
|
|
@@ -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('
|
|
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('
|
|
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,
|
|
@@ -6440,10 +6455,10 @@ class Publisher {
|
|
|
6440
6455
|
this.logger('error', `ICE Candidate error`, errorMessage);
|
|
6441
6456
|
};
|
|
6442
6457
|
this.onIceConnectionStateChange = () => {
|
|
6443
|
-
this.logger('
|
|
6458
|
+
this.logger('debug', `ICE Connection state changed`, this.pc.iceConnectionState);
|
|
6444
6459
|
};
|
|
6445
6460
|
this.onIceGatheringStateChange = () => {
|
|
6446
|
-
this.logger('
|
|
6461
|
+
this.logger('debug', `ICE Gathering State`, this.pc.iceGatheringState);
|
|
6447
6462
|
};
|
|
6448
6463
|
this.onSignalingStateChange = () => {
|
|
6449
6464
|
this.logger('debug', `Signaling state changed`, this.pc.signalingState);
|
|
@@ -6610,7 +6625,7 @@ class Subscriber {
|
|
|
6610
6625
|
this.onIceCandidate = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
6611
6626
|
const { candidate } = e;
|
|
6612
6627
|
if (!candidate) {
|
|
6613
|
-
logger$1('
|
|
6628
|
+
logger$1('debug', 'null ice candidate');
|
|
6614
6629
|
return;
|
|
6615
6630
|
}
|
|
6616
6631
|
yield this.sfuClient.iceTrickle({
|
|
@@ -6919,7 +6934,7 @@ class StreamSfuClient {
|
|
|
6919
6934
|
if (this.lastMessageTimestamp) {
|
|
6920
6935
|
const timeSinceLastMessage = new Date().getTime() - this.lastMessageTimestamp.getTime();
|
|
6921
6936
|
if (timeSinceLastMessage > this.unhealthyTimeoutInMs) {
|
|
6922
|
-
this.logger('
|
|
6937
|
+
this.logger('debug', 'SFU connection unhealthy, closing');
|
|
6923
6938
|
this.close(4001, `SFU connection unhealthy. Didn't receive any healthcheck messages for ${this.unhealthyTimeoutInMs}ms`);
|
|
6924
6939
|
}
|
|
6925
6940
|
}
|
|
@@ -8026,6 +8041,16 @@ const watchParticipantCountChanged = (dispatcher, state) => {
|
|
|
8026
8041
|
}
|
|
8027
8042
|
});
|
|
8028
8043
|
};
|
|
8044
|
+
const watchLiveEnded = (dispatcher, call) => {
|
|
8045
|
+
return dispatcher.on('error', (e) => {
|
|
8046
|
+
if (e.eventPayload.oneofKind !== 'error' ||
|
|
8047
|
+
!e.eventPayload.error.error ||
|
|
8048
|
+
e.eventPayload.error.error.code !== ErrorCode.LIVE_ENDED)
|
|
8049
|
+
return;
|
|
8050
|
+
if (!call.permissionsContext.hasPermission(OwnCapability.JOIN_BACKSTAGE))
|
|
8051
|
+
call.leave();
|
|
8052
|
+
});
|
|
8053
|
+
};
|
|
8029
8054
|
/**
|
|
8030
8055
|
* Watches and logs the errors reported by the currently connected SFU.
|
|
8031
8056
|
*/
|
|
@@ -8415,6 +8440,7 @@ const registerEventHandlers = (call, state, dispatcher) => {
|
|
|
8415
8440
|
'call.user_muted': () => console.log('call.user_muted received'),
|
|
8416
8441
|
};
|
|
8417
8442
|
const eventHandlers = [
|
|
8443
|
+
watchLiveEnded(dispatcher, call),
|
|
8418
8444
|
watchSfuErrorReports(dispatcher),
|
|
8419
8445
|
watchChangePublishQuality(dispatcher, call),
|
|
8420
8446
|
watchConnectionQualityChanged(dispatcher, state),
|
|
@@ -8673,7 +8699,7 @@ const createStatsReporter = ({ subscriber, publisher, state, pollingIntervalInMs
|
|
|
8673
8699
|
if (pollingIntervalInMs > 0) {
|
|
8674
8700
|
const loop = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8675
8701
|
yield run().catch((e) => {
|
|
8676
|
-
logger('
|
|
8702
|
+
logger('debug', 'Failed to collect stats', e);
|
|
8677
8703
|
});
|
|
8678
8704
|
timeoutId = setTimeout(loop, pollingIntervalInMs);
|
|
8679
8705
|
});
|
|
@@ -11742,7 +11768,7 @@ class StreamClient {
|
|
|
11742
11768
|
};
|
|
11743
11769
|
this.getUserAgent = () => {
|
|
11744
11770
|
return (this.userAgent ||
|
|
11745
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.
|
|
11771
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.41"}`);
|
|
11746
11772
|
};
|
|
11747
11773
|
this.setUserAgent = (userAgent) => {
|
|
11748
11774
|
this.userAgent = userAgent;
|
|
@@ -12167,7 +12193,7 @@ class StreamVideoClient {
|
|
|
12167
12193
|
return;
|
|
12168
12194
|
const { call, members } = event;
|
|
12169
12195
|
if (userToConnect.id === call.created_by.id) {
|
|
12170
|
-
this.logger('
|
|
12196
|
+
this.logger('debug', 'Received `call.ring` sent by the current user so ignoring the event');
|
|
12171
12197
|
return;
|
|
12172
12198
|
}
|
|
12173
12199
|
// The call might already be tracked by the client,
|