@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/dist/index.es.js
CHANGED
|
@@ -6056,6 +6056,14 @@ class Publisher {
|
|
|
6056
6056
|
[TrackType.SCREEN_SHARE_AUDIO]: undefined,
|
|
6057
6057
|
[TrackType.UNSPECIFIED]: undefined,
|
|
6058
6058
|
};
|
|
6059
|
+
/**
|
|
6060
|
+
* An array maintaining the order how transceivers were added to the peer connection.
|
|
6061
|
+
* This is needed because some browsers (Firefox) don't reliably report
|
|
6062
|
+
* trackId and `mid` parameters.
|
|
6063
|
+
*
|
|
6064
|
+
* @private
|
|
6065
|
+
*/
|
|
6066
|
+
this.transceiverInitOrder = [];
|
|
6059
6067
|
this.trackKindMapping = {
|
|
6060
6068
|
[TrackType.AUDIO]: 'audio',
|
|
6061
6069
|
[TrackType.VIDEO]: 'video',
|
|
@@ -6149,6 +6157,8 @@ class Publisher {
|
|
|
6149
6157
|
: undefined,
|
|
6150
6158
|
sendEncodings: videoEncodings,
|
|
6151
6159
|
});
|
|
6160
|
+
this.logger('debug', `Added ${TrackType[trackType]} transceiver`);
|
|
6161
|
+
this.transceiverInitOrder.push(trackType);
|
|
6152
6162
|
this.transceiverRegistry[trackType] = transceiver;
|
|
6153
6163
|
if ('setCodecPreferences' in transceiver && codecPreferences) {
|
|
6154
6164
|
this.logger('info', `Setting ${TrackType[trackType]} codec preferences`, codecPreferences);
|
|
@@ -6283,7 +6293,7 @@ class Publisher {
|
|
|
6283
6293
|
this.onIceCandidate = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
6284
6294
|
const { candidate } = e;
|
|
6285
6295
|
if (!candidate) {
|
|
6286
|
-
this.logger('
|
|
6296
|
+
this.logger('debug', 'null ice candidate');
|
|
6287
6297
|
return;
|
|
6288
6298
|
}
|
|
6289
6299
|
yield this.sfuClient.iceTrickle({
|
|
@@ -6371,14 +6381,14 @@ class Publisher {
|
|
|
6371
6381
|
this.getCurrentTrackInfos = (sdp) => {
|
|
6372
6382
|
var _a;
|
|
6373
6383
|
sdp = sdp || ((_a = this.pc.localDescription) === null || _a === void 0 ? void 0 : _a.sdp);
|
|
6374
|
-
const extractMid = (defaultMid, track) => {
|
|
6384
|
+
const extractMid = (defaultMid, track, trackType) => {
|
|
6375
6385
|
if (defaultMid)
|
|
6376
6386
|
return defaultMid;
|
|
6377
6387
|
if (!sdp) {
|
|
6378
6388
|
this.logger('warn', 'No SDP found. Returning empty mid');
|
|
6379
6389
|
return '';
|
|
6380
6390
|
}
|
|
6381
|
-
this.logger('
|
|
6391
|
+
this.logger('debug', `No 'mid' found for track. Trying to find it from the Offer SDP`);
|
|
6382
6392
|
const parsedSdp = SDP.parse(sdp);
|
|
6383
6393
|
const media = parsedSdp.media.find((m) => {
|
|
6384
6394
|
var _a, _b;
|
|
@@ -6387,7 +6397,12 @@ class Publisher {
|
|
|
6387
6397
|
((_b = (_a = m.msid) === null || _a === void 0 ? void 0 : _a.includes(track.id)) !== null && _b !== void 0 ? _b : true));
|
|
6388
6398
|
});
|
|
6389
6399
|
if (typeof (media === null || media === void 0 ? void 0 : media.mid) === 'undefined') {
|
|
6390
|
-
this.logger('
|
|
6400
|
+
this.logger('debug', `No mid found in SDP for track type ${track.kind} and id ${track.id}. Attempting to find a heuristic mid`);
|
|
6401
|
+
const heuristicMid = this.transceiverInitOrder.indexOf(trackType);
|
|
6402
|
+
if (heuristicMid !== -1) {
|
|
6403
|
+
return String(heuristicMid);
|
|
6404
|
+
}
|
|
6405
|
+
this.logger('debug', 'No heuristic mid found. Returning empty mid');
|
|
6391
6406
|
return '';
|
|
6392
6407
|
}
|
|
6393
6408
|
return String(media.mid);
|
|
@@ -6429,7 +6444,7 @@ class Publisher {
|
|
|
6429
6444
|
trackId: track.id,
|
|
6430
6445
|
layers: layers,
|
|
6431
6446
|
trackType,
|
|
6432
|
-
mid: extractMid(transceiver.mid, track),
|
|
6447
|
+
mid: extractMid(transceiver.mid, track, trackType),
|
|
6433
6448
|
// FIXME OL: adjust these values
|
|
6434
6449
|
stereo: false,
|
|
6435
6450
|
dtx: TrackType.AUDIO === trackType && this.isDtxEnabled,
|
|
@@ -6443,10 +6458,10 @@ class Publisher {
|
|
|
6443
6458
|
this.logger('error', `ICE Candidate error`, errorMessage);
|
|
6444
6459
|
};
|
|
6445
6460
|
this.onIceConnectionStateChange = () => {
|
|
6446
|
-
this.logger('
|
|
6461
|
+
this.logger('debug', `ICE Connection state changed`, this.pc.iceConnectionState);
|
|
6447
6462
|
};
|
|
6448
6463
|
this.onIceGatheringStateChange = () => {
|
|
6449
|
-
this.logger('
|
|
6464
|
+
this.logger('debug', `ICE Gathering State`, this.pc.iceGatheringState);
|
|
6450
6465
|
};
|
|
6451
6466
|
this.onSignalingStateChange = () => {
|
|
6452
6467
|
this.logger('debug', `Signaling state changed`, this.pc.signalingState);
|
|
@@ -6613,7 +6628,7 @@ class Subscriber {
|
|
|
6613
6628
|
this.onIceCandidate = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
6614
6629
|
const { candidate } = e;
|
|
6615
6630
|
if (!candidate) {
|
|
6616
|
-
logger$1('
|
|
6631
|
+
logger$1('debug', 'null ice candidate');
|
|
6617
6632
|
return;
|
|
6618
6633
|
}
|
|
6619
6634
|
yield this.sfuClient.iceTrickle({
|
|
@@ -6922,7 +6937,7 @@ class StreamSfuClient {
|
|
|
6922
6937
|
if (this.lastMessageTimestamp) {
|
|
6923
6938
|
const timeSinceLastMessage = new Date().getTime() - this.lastMessageTimestamp.getTime();
|
|
6924
6939
|
if (timeSinceLastMessage > this.unhealthyTimeoutInMs) {
|
|
6925
|
-
this.logger('
|
|
6940
|
+
this.logger('debug', 'SFU connection unhealthy, closing');
|
|
6926
6941
|
this.close(4001, `SFU connection unhealthy. Didn't receive any healthcheck messages for ${this.unhealthyTimeoutInMs}ms`);
|
|
6927
6942
|
}
|
|
6928
6943
|
}
|
|
@@ -8029,6 +8044,16 @@ const watchParticipantCountChanged = (dispatcher, state) => {
|
|
|
8029
8044
|
}
|
|
8030
8045
|
});
|
|
8031
8046
|
};
|
|
8047
|
+
const watchLiveEnded = (dispatcher, call) => {
|
|
8048
|
+
return dispatcher.on('error', (e) => {
|
|
8049
|
+
if (e.eventPayload.oneofKind !== 'error' ||
|
|
8050
|
+
!e.eventPayload.error.error ||
|
|
8051
|
+
e.eventPayload.error.error.code !== ErrorCode.LIVE_ENDED)
|
|
8052
|
+
return;
|
|
8053
|
+
if (!call.permissionsContext.hasPermission(OwnCapability.JOIN_BACKSTAGE))
|
|
8054
|
+
call.leave();
|
|
8055
|
+
});
|
|
8056
|
+
};
|
|
8032
8057
|
/**
|
|
8033
8058
|
* Watches and logs the errors reported by the currently connected SFU.
|
|
8034
8059
|
*/
|
|
@@ -8418,6 +8443,7 @@ const registerEventHandlers = (call, state, dispatcher) => {
|
|
|
8418
8443
|
'call.user_muted': () => console.log('call.user_muted received'),
|
|
8419
8444
|
};
|
|
8420
8445
|
const eventHandlers = [
|
|
8446
|
+
watchLiveEnded(dispatcher, call),
|
|
8421
8447
|
watchSfuErrorReports(dispatcher),
|
|
8422
8448
|
watchChangePublishQuality(dispatcher, call),
|
|
8423
8449
|
watchConnectionQualityChanged(dispatcher, state),
|
|
@@ -8676,7 +8702,7 @@ const createStatsReporter = ({ subscriber, publisher, state, pollingIntervalInMs
|
|
|
8676
8702
|
if (pollingIntervalInMs > 0) {
|
|
8677
8703
|
const loop = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8678
8704
|
yield run().catch((e) => {
|
|
8679
|
-
logger('
|
|
8705
|
+
logger('debug', 'Failed to collect stats', e);
|
|
8680
8706
|
});
|
|
8681
8707
|
timeoutId = setTimeout(loop, pollingIntervalInMs);
|
|
8682
8708
|
});
|
|
@@ -11746,7 +11772,7 @@ class StreamClient {
|
|
|
11746
11772
|
};
|
|
11747
11773
|
this.getUserAgent = () => {
|
|
11748
11774
|
return (this.userAgent ||
|
|
11749
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.
|
|
11775
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.41"}`);
|
|
11750
11776
|
};
|
|
11751
11777
|
this.setUserAgent = (userAgent) => {
|
|
11752
11778
|
this.userAgent = userAgent;
|
|
@@ -12171,7 +12197,7 @@ class StreamVideoClient {
|
|
|
12171
12197
|
return;
|
|
12172
12198
|
const { call, members } = event;
|
|
12173
12199
|
if (userToConnect.id === call.created_by.id) {
|
|
12174
|
-
this.logger('
|
|
12200
|
+
this.logger('debug', 'Received `call.ring` sent by the current user so ignoring the event');
|
|
12175
12201
|
return;
|
|
12176
12202
|
}
|
|
12177
12203
|
// The call might already be tracked by the client,
|