@reactoo/watchtogether-sdk-js 2.8.40 → 2.8.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.
|
@@ -55500,7 +55500,10 @@ function _removeFromSubscribeMap(id, mid) {
|
|
|
55500
55500
|
}
|
|
55501
55501
|
// will subscribe to all relevant participants
|
|
55502
55502
|
async function _updateSubscriptions() {
|
|
55503
|
-
//
|
|
55503
|
+
// added sanity check
|
|
55504
|
+
await _assertClassBrand(_RoomSession_brand, this, _availablePublishersSanityCheck).call(this);
|
|
55505
|
+
|
|
55506
|
+
// no subscription yet, we create one and subscribe to relevant participants
|
|
55504
55507
|
|
|
55505
55508
|
if (!_classPrivateFieldGet(_subscriberJoinPromise, this)) {
|
|
55506
55509
|
await _assertClassBrand(_RoomSession_brand, this, _joinAsSubscriber).call(this, this.roomId, this.pin, this.userId);
|
|
@@ -55659,15 +55662,63 @@ function _updateAvailablePublishersTrackData(newPublishers, removedPublisher) {
|
|
|
55659
55662
|
}
|
|
55660
55663
|
}
|
|
55661
55664
|
}
|
|
55665
|
+
async function _availablePublishersSanityCheck() {
|
|
55666
|
+
var _classPrivateFieldGet28, _classPrivateFieldGet29;
|
|
55667
|
+
const list = await this.sendMessage(this.handleId, {
|
|
55668
|
+
body: {
|
|
55669
|
+
request: 'listparticipants',
|
|
55670
|
+
room: this.roomId
|
|
55671
|
+
}
|
|
55672
|
+
});
|
|
55673
|
+
const participants = list.participants || [];
|
|
55674
|
+
const availablePublishers = [...(((_classPrivateFieldGet28 = _classPrivateFieldGet(_subscriberHandle, this)) === null || _classPrivateFieldGet28 === void 0 ? void 0 : (_classPrivateFieldGet29 = _classPrivateFieldGet28.webrtcStuff) === null || _classPrivateFieldGet29 === void 0 ? void 0 : _classPrivateFieldGet29.availablePublishers) ?? [])];
|
|
55675
|
+
availablePublishers.forEach(publisher => {
|
|
55676
|
+
const checkedParticipant = participants.find(p => p.id === publisher.id);
|
|
55677
|
+
if (!checkedParticipant) {
|
|
55678
|
+
// this publisher is not in the list, we need to remove it
|
|
55679
|
+
this._log('Sanity check - Removing publisher', publisher.id, 'from availablePublishers');
|
|
55680
|
+
_assertClassBrand(_RoomSession_brand, this, _updateAvailablePublishersTrackData).call(this, [], publisher.id);
|
|
55681
|
+
_assertClassBrand(_RoomSession_brand, this, _emitRemoteFeedUpdate).call(this, null, {
|
|
55682
|
+
feedRemoval: true,
|
|
55683
|
+
attendee: {
|
|
55684
|
+
id: publisher.id
|
|
55685
|
+
}
|
|
55686
|
+
});
|
|
55687
|
+
_assertClassBrand(_RoomSession_brand, this, _removeAttendeeFromCache).call(this, publisher.id);
|
|
55688
|
+
this.emit('error', {
|
|
55689
|
+
type: 'warning',
|
|
55690
|
+
id: 50,
|
|
55691
|
+
message: 'sanity check - removing publisher from availablePublishers',
|
|
55692
|
+
data: publisher.id
|
|
55693
|
+
});
|
|
55694
|
+
} else if (checkedParticipant.publisher === false) {
|
|
55695
|
+
// this publisher is not in the list, we need to remove it
|
|
55696
|
+
this._log('Sanity check - Removing publisher', publisher.id, 'from availablePublishers');
|
|
55697
|
+
_assertClassBrand(_RoomSession_brand, this, _updateAvailablePublishersTrackData).call(this, [], publisher.id);
|
|
55698
|
+
_assertClassBrand(_RoomSession_brand, this, _emitRemoteFeedUpdate).call(this, null, {
|
|
55699
|
+
feedRemoval: true,
|
|
55700
|
+
attendee: {
|
|
55701
|
+
id: publisher.id
|
|
55702
|
+
}
|
|
55703
|
+
});
|
|
55704
|
+
this.emit('error', {
|
|
55705
|
+
type: 'warning',
|
|
55706
|
+
id: 51,
|
|
55707
|
+
message: 'sanity check - removing publisher from availablePublishers',
|
|
55708
|
+
data: publisher.id
|
|
55709
|
+
});
|
|
55710
|
+
}
|
|
55711
|
+
});
|
|
55712
|
+
}
|
|
55662
55713
|
function _getTransceiverDataByMid(mid) {
|
|
55663
55714
|
return _classPrivateFieldGet(_subscriberHandle, this).webrtcStuff.transceiverMap.find(t => t.mid === mid);
|
|
55664
55715
|
}
|
|
55665
55716
|
// this is done
|
|
55666
55717
|
// feed_id === id of participant
|
|
55667
55718
|
function _updateTransceiverMap(handleId) {
|
|
55668
|
-
var
|
|
55719
|
+
var _classPrivateFieldGet30;
|
|
55669
55720
|
let streams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
55670
|
-
this._log('Updating current transceiver map', 'Is me: ' + handleId === ((
|
|
55721
|
+
this._log('Updating current transceiver map', 'Is me: ' + handleId === ((_classPrivateFieldGet30 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet30 === void 0 ? void 0 : _classPrivateFieldGet30.handleId), handleId, streams);
|
|
55671
55722
|
let handle = _assertClassBrand(_RoomSession_brand, this, _getHandle).call(this, handleId);
|
|
55672
55723
|
if (!handle) {
|
|
55673
55724
|
this.emit('error', {
|
|
@@ -56005,7 +56056,7 @@ function _stopKeepAlive() {
|
|
|
56005
56056
|
clearTimeout(this._keepAliveId);
|
|
56006
56057
|
}
|
|
56007
56058
|
function _handleWsEvents(event) {
|
|
56008
|
-
var
|
|
56059
|
+
var _classPrivateFieldGet31;
|
|
56009
56060
|
let skipPoll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
56010
56061
|
// we have a response from long poll, that means we need to run it again
|
|
56011
56062
|
if (!this.useWebsockets && !skipPoll) {
|
|
@@ -56076,7 +56127,7 @@ function _handleWsEvents(event) {
|
|
|
56076
56127
|
|
|
56077
56128
|
// LOCAL
|
|
56078
56129
|
|
|
56079
|
-
if (sender === ((
|
|
56130
|
+
if (sender === ((_classPrivateFieldGet31 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet31 === void 0 ? void 0 : _classPrivateFieldGet31.handleId)) {
|
|
56080
56131
|
if (type === "event") {
|
|
56081
56132
|
var plugindata = json["plugindata"] || {};
|
|
56082
56133
|
var msg = plugindata["data"] || {};
|
|
@@ -56136,8 +56187,8 @@ function _handleWsEvents(event) {
|
|
|
56136
56187
|
this._log(e);
|
|
56137
56188
|
});
|
|
56138
56189
|
if (leaving === 'ok') {
|
|
56139
|
-
var
|
|
56140
|
-
this._log('leaving', (
|
|
56190
|
+
var _classPrivateFieldGet32;
|
|
56191
|
+
this._log('leaving', (_classPrivateFieldGet32 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet32 === void 0 ? void 0 : _classPrivateFieldGet32.handleId, 'this is us');
|
|
56141
56192
|
_assertClassBrand(_RoomSession_brand, this, _emitLocalFeedUpdate).call(this, {
|
|
56142
56193
|
feedRemoval: true
|
|
56143
56194
|
});
|
|
@@ -56160,9 +56211,9 @@ function _handleWsEvents(event) {
|
|
|
56160
56211
|
_assertClassBrand(_RoomSession_brand, this, _removeAttendeeFromCache).call(this, leaving);
|
|
56161
56212
|
}
|
|
56162
56213
|
if (unpublished === 'ok') {
|
|
56163
|
-
var
|
|
56164
|
-
this._log('unpublished', (
|
|
56165
|
-
_assertClassBrand(_RoomSession_brand, this, _cleanupHandle).call(this, (
|
|
56214
|
+
var _classPrivateFieldGet33, _classPrivateFieldGet34;
|
|
56215
|
+
this._log('unpublished', (_classPrivateFieldGet33 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet33 === void 0 ? void 0 : _classPrivateFieldGet33.handleId, 'this is us');
|
|
56216
|
+
_assertClassBrand(_RoomSession_brand, this, _cleanupHandle).call(this, (_classPrivateFieldGet34 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet34 === void 0 ? void 0 : _classPrivateFieldGet34.handleId, true).catch(() => {});
|
|
56166
56217
|
} else if (unpublished) {
|
|
56167
56218
|
this._log('unpublished', unpublished);
|
|
56168
56219
|
_assertClassBrand(_RoomSession_brand, this, _updateAvailablePublishersTrackData).call(this, [], unpublished);
|
|
@@ -56178,6 +56229,13 @@ function _handleWsEvents(event) {
|
|
|
56178
56229
|
_assertClassBrand(_RoomSession_brand, this, _updateSubscriptions).call(this).catch(e => {
|
|
56179
56230
|
this._log(e);
|
|
56180
56231
|
});
|
|
56232
|
+
_assertClassBrand(_RoomSession_brand, this, _emitRemoteFeedUpdate).call(this, null, {
|
|
56233
|
+
feedRemoval: true,
|
|
56234
|
+
attendee: {
|
|
56235
|
+
id: leaving
|
|
56236
|
+
}
|
|
56237
|
+
});
|
|
56238
|
+
_assertClassBrand(_RoomSession_brand, this, _removeAttendeeFromCache).call(this, leaving);
|
|
56181
56239
|
}
|
|
56182
56240
|
if (joining) {
|
|
56183
56241
|
_assertClassBrand(_RoomSession_brand, this, _cacheAttendee).call(this, joining);
|
|
@@ -56195,8 +56253,8 @@ function _handleWsEvents(event) {
|
|
|
56195
56253
|
}
|
|
56196
56254
|
}
|
|
56197
56255
|
if (jsep !== undefined && jsep !== null) {
|
|
56198
|
-
var
|
|
56199
|
-
_assertClassBrand(_RoomSession_brand, this, _webrtcPeer).call(this, (
|
|
56256
|
+
var _classPrivateFieldGet35;
|
|
56257
|
+
_assertClassBrand(_RoomSession_brand, this, _webrtcPeer).call(this, (_classPrivateFieldGet35 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet35 === void 0 ? void 0 : _classPrivateFieldGet35.handleId, jsep).catch(err => {
|
|
56200
56258
|
this.emit('error', err);
|
|
56201
56259
|
});
|
|
56202
56260
|
}
|
|
@@ -56206,8 +56264,8 @@ function _handleWsEvents(event) {
|
|
|
56206
56264
|
}
|
|
56207
56265
|
this._log('Configuring bitrate: ' + this.initialBitrate);
|
|
56208
56266
|
if (this.initialBitrate > 0) {
|
|
56209
|
-
var
|
|
56210
|
-
this.sendMessage((
|
|
56267
|
+
var _classPrivateFieldGet36;
|
|
56268
|
+
this.sendMessage((_classPrivateFieldGet36 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet36 === void 0 ? void 0 : _classPrivateFieldGet36.handleId, {
|
|
56211
56269
|
"body": {
|
|
56212
56270
|
"request": "configure",
|
|
56213
56271
|
"bitrate": this.initialBitrate
|
|
@@ -56361,7 +56419,7 @@ async function _destroyHandle(handleId) {
|
|
|
56361
56419
|
if (handleId) {
|
|
56362
56420
|
let handle = _assertClassBrand(_RoomSession_brand, this, _getHandle).call(this, handleId);
|
|
56363
56421
|
if (handle) {
|
|
56364
|
-
var
|
|
56422
|
+
var _classPrivateFieldGet37, _classPrivateFieldGet38;
|
|
56365
56423
|
await _assertClassBrand(_RoomSession_brand, this, _cleanupHandle).call(this, handleId);
|
|
56366
56424
|
if (detachRequest) {
|
|
56367
56425
|
await _assertClassBrand(_RoomSession_brand, this, _send).call(this, {
|
|
@@ -56369,16 +56427,16 @@ async function _destroyHandle(handleId) {
|
|
|
56369
56427
|
"handle_id": handleId
|
|
56370
56428
|
}, true);
|
|
56371
56429
|
}
|
|
56372
|
-
if (handleId === ((
|
|
56430
|
+
if (handleId === ((_classPrivateFieldGet37 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet37 === void 0 ? void 0 : _classPrivateFieldGet37.handleId)) {
|
|
56373
56431
|
_classPrivateFieldSet(_publisherHandle, this, null);
|
|
56374
|
-
} else if (handleId === ((
|
|
56432
|
+
} else if (handleId === ((_classPrivateFieldGet38 = _classPrivateFieldGet(_subscriberHandle, this)) === null || _classPrivateFieldGet38 === void 0 ? void 0 : _classPrivateFieldGet38.handleId)) {
|
|
56375
56433
|
_classPrivateFieldSet(_subscriberHandle, this, null);
|
|
56376
56434
|
}
|
|
56377
56435
|
}
|
|
56378
56436
|
}
|
|
56379
56437
|
}
|
|
56380
56438
|
async function _cleanupHandle(handleId) {
|
|
56381
|
-
var
|
|
56439
|
+
var _classPrivateFieldGet39;
|
|
56382
56440
|
let hangupRequest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
56383
56441
|
let handle = _assertClassBrand(_RoomSession_brand, this, _getHandle).call(this, handleId);
|
|
56384
56442
|
if (hangupRequest) {
|
|
@@ -56462,7 +56520,7 @@ async function _cleanupHandle(handleId) {
|
|
|
56462
56520
|
qualityHistory: new Map(),
|
|
56463
56521
|
lastSwitchTime: new Map()
|
|
56464
56522
|
};
|
|
56465
|
-
if (_classPrivateFieldGet(_publisherHandle, this) && handleId === ((
|
|
56523
|
+
if (_classPrivateFieldGet(_publisherHandle, this) && handleId === ((_classPrivateFieldGet39 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet39 === void 0 ? void 0 : _classPrivateFieldGet39.handleId)) {
|
|
56466
56524
|
_assertClassBrand(_RoomSession_brand, this, _emitLocalFeedUpdate).call(this, {
|
|
56467
56525
|
feedRemoval: true
|
|
56468
56526
|
});
|
|
@@ -56479,8 +56537,8 @@ async function _cleanupHandle(handleId) {
|
|
|
56479
56537
|
}
|
|
56480
56538
|
}
|
|
56481
56539
|
async function _joinAsPublisher(roomId, pin, userId, display) {
|
|
56482
|
-
var
|
|
56483
|
-
return this.sendMessage((
|
|
56540
|
+
var _classPrivateFieldGet40;
|
|
56541
|
+
return this.sendMessage((_classPrivateFieldGet40 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet40 === void 0 ? void 0 : _classPrivateFieldGet40.handleId, {
|
|
56484
56542
|
body: {
|
|
56485
56543
|
"request": "join",
|
|
56486
56544
|
"room": roomId,
|
|
@@ -56559,9 +56617,9 @@ async function _joinAsSubscriber(roomId, pin, userId) {
|
|
|
56559
56617
|
return _classPrivateFieldGet(_subscriberJoinPromise, this);
|
|
56560
56618
|
}
|
|
56561
56619
|
async function _leaveRoom() {
|
|
56562
|
-
var
|
|
56620
|
+
var _classPrivateFieldGet41;
|
|
56563
56621
|
let dontWait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
56564
|
-
return this.isConnected ? this.sendMessage((
|
|
56622
|
+
return this.isConnected ? this.sendMessage((_classPrivateFieldGet41 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet41 === void 0 ? void 0 : _classPrivateFieldGet41.handleId, {
|
|
56565
56623
|
body: {
|
|
56566
56624
|
"request": "leave"
|
|
56567
56625
|
}
|
|
@@ -56778,14 +56836,14 @@ function _enableDebug2() {
|
|
|
56778
56836
|
this._log = console.log.bind(console);
|
|
56779
56837
|
}
|
|
56780
56838
|
function _getHandle(handleId) {
|
|
56781
|
-
var
|
|
56839
|
+
var _classPrivateFieldGet42, _classPrivateFieldGet43;
|
|
56782
56840
|
let rfid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
56783
56841
|
let userId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
56784
56842
|
let fullUserId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
56785
|
-
if (handleId === ((
|
|
56843
|
+
if (handleId === ((_classPrivateFieldGet42 = _classPrivateFieldGet(_subscriberHandle, this)) === null || _classPrivateFieldGet42 === void 0 ? void 0 : _classPrivateFieldGet42.handleId)) {
|
|
56786
56844
|
return _classPrivateFieldGet(_subscriberHandle, this);
|
|
56787
56845
|
}
|
|
56788
|
-
if (handleId === ((
|
|
56846
|
+
if (handleId === ((_classPrivateFieldGet43 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet43 === void 0 ? void 0 : _classPrivateFieldGet43.handleId)) {
|
|
56789
56847
|
return _classPrivateFieldGet(_publisherHandle, this);
|
|
56790
56848
|
}
|
|
56791
56849
|
return null;
|
|
@@ -56896,20 +56954,20 @@ function _webrtc(handleId) {
|
|
|
56896
56954
|
};
|
|
56897
56955
|
}
|
|
56898
56956
|
config.pc.onconnectionstatechange = () => {
|
|
56899
|
-
var
|
|
56957
|
+
var _classPrivateFieldGet44;
|
|
56900
56958
|
if (config.pc.connectionState === 'failed') {
|
|
56901
56959
|
this._log('onconnectionstatechange: connectionState === failed');
|
|
56902
56960
|
_assertClassBrand(_RoomSession_brand, this, _iceRestart).call(this, handleId);
|
|
56903
56961
|
}
|
|
56904
|
-
this.emit('connectionState', [handleId, handleId === ((
|
|
56962
|
+
this.emit('connectionState', [handleId, handleId === ((_classPrivateFieldGet44 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet44 === void 0 ? void 0 : _classPrivateFieldGet44.handleId), config.pc.connectionState]);
|
|
56905
56963
|
};
|
|
56906
56964
|
config.pc.oniceconnectionstatechange = () => {
|
|
56907
|
-
var
|
|
56965
|
+
var _classPrivateFieldGet45;
|
|
56908
56966
|
if (config.pc.iceConnectionState === 'failed') {
|
|
56909
56967
|
this._log('oniceconnectionstatechange: iceConnectionState === failed');
|
|
56910
56968
|
_assertClassBrand(_RoomSession_brand, this, _iceRestart).call(this, handleId);
|
|
56911
56969
|
}
|
|
56912
|
-
this.emit('iceState', [handleId, handleId === ((
|
|
56970
|
+
this.emit('iceState', [handleId, handleId === ((_classPrivateFieldGet45 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet45 === void 0 ? void 0 : _classPrivateFieldGet45.handleId), config.pc.iceConnectionState]);
|
|
56913
56971
|
};
|
|
56914
56972
|
config.pc.onicecandidate = event => {
|
|
56915
56973
|
if (event.candidate == null || webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__["default"].browserDetails.browser === 'edge' && event.candidate.candidate.indexOf('endOfCandidates') > 0) {
|