@reactoo/watchtogether-sdk-js 2.8.40 → 2.8.41
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);
|
|
@@ -56195,8 +56246,8 @@ function _handleWsEvents(event) {
|
|
|
56195
56246
|
}
|
|
56196
56247
|
}
|
|
56197
56248
|
if (jsep !== undefined && jsep !== null) {
|
|
56198
|
-
var
|
|
56199
|
-
_assertClassBrand(_RoomSession_brand, this, _webrtcPeer).call(this, (
|
|
56249
|
+
var _classPrivateFieldGet35;
|
|
56250
|
+
_assertClassBrand(_RoomSession_brand, this, _webrtcPeer).call(this, (_classPrivateFieldGet35 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet35 === void 0 ? void 0 : _classPrivateFieldGet35.handleId, jsep).catch(err => {
|
|
56200
56251
|
this.emit('error', err);
|
|
56201
56252
|
});
|
|
56202
56253
|
}
|
|
@@ -56206,8 +56257,8 @@ function _handleWsEvents(event) {
|
|
|
56206
56257
|
}
|
|
56207
56258
|
this._log('Configuring bitrate: ' + this.initialBitrate);
|
|
56208
56259
|
if (this.initialBitrate > 0) {
|
|
56209
|
-
var
|
|
56210
|
-
this.sendMessage((
|
|
56260
|
+
var _classPrivateFieldGet36;
|
|
56261
|
+
this.sendMessage((_classPrivateFieldGet36 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet36 === void 0 ? void 0 : _classPrivateFieldGet36.handleId, {
|
|
56211
56262
|
"body": {
|
|
56212
56263
|
"request": "configure",
|
|
56213
56264
|
"bitrate": this.initialBitrate
|
|
@@ -56361,7 +56412,7 @@ async function _destroyHandle(handleId) {
|
|
|
56361
56412
|
if (handleId) {
|
|
56362
56413
|
let handle = _assertClassBrand(_RoomSession_brand, this, _getHandle).call(this, handleId);
|
|
56363
56414
|
if (handle) {
|
|
56364
|
-
var
|
|
56415
|
+
var _classPrivateFieldGet37, _classPrivateFieldGet38;
|
|
56365
56416
|
await _assertClassBrand(_RoomSession_brand, this, _cleanupHandle).call(this, handleId);
|
|
56366
56417
|
if (detachRequest) {
|
|
56367
56418
|
await _assertClassBrand(_RoomSession_brand, this, _send).call(this, {
|
|
@@ -56369,16 +56420,16 @@ async function _destroyHandle(handleId) {
|
|
|
56369
56420
|
"handle_id": handleId
|
|
56370
56421
|
}, true);
|
|
56371
56422
|
}
|
|
56372
|
-
if (handleId === ((
|
|
56423
|
+
if (handleId === ((_classPrivateFieldGet37 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet37 === void 0 ? void 0 : _classPrivateFieldGet37.handleId)) {
|
|
56373
56424
|
_classPrivateFieldSet(_publisherHandle, this, null);
|
|
56374
|
-
} else if (handleId === ((
|
|
56425
|
+
} else if (handleId === ((_classPrivateFieldGet38 = _classPrivateFieldGet(_subscriberHandle, this)) === null || _classPrivateFieldGet38 === void 0 ? void 0 : _classPrivateFieldGet38.handleId)) {
|
|
56375
56426
|
_classPrivateFieldSet(_subscriberHandle, this, null);
|
|
56376
56427
|
}
|
|
56377
56428
|
}
|
|
56378
56429
|
}
|
|
56379
56430
|
}
|
|
56380
56431
|
async function _cleanupHandle(handleId) {
|
|
56381
|
-
var
|
|
56432
|
+
var _classPrivateFieldGet39;
|
|
56382
56433
|
let hangupRequest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
56383
56434
|
let handle = _assertClassBrand(_RoomSession_brand, this, _getHandle).call(this, handleId);
|
|
56384
56435
|
if (hangupRequest) {
|
|
@@ -56462,7 +56513,7 @@ async function _cleanupHandle(handleId) {
|
|
|
56462
56513
|
qualityHistory: new Map(),
|
|
56463
56514
|
lastSwitchTime: new Map()
|
|
56464
56515
|
};
|
|
56465
|
-
if (_classPrivateFieldGet(_publisherHandle, this) && handleId === ((
|
|
56516
|
+
if (_classPrivateFieldGet(_publisherHandle, this) && handleId === ((_classPrivateFieldGet39 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet39 === void 0 ? void 0 : _classPrivateFieldGet39.handleId)) {
|
|
56466
56517
|
_assertClassBrand(_RoomSession_brand, this, _emitLocalFeedUpdate).call(this, {
|
|
56467
56518
|
feedRemoval: true
|
|
56468
56519
|
});
|
|
@@ -56479,8 +56530,8 @@ async function _cleanupHandle(handleId) {
|
|
|
56479
56530
|
}
|
|
56480
56531
|
}
|
|
56481
56532
|
async function _joinAsPublisher(roomId, pin, userId, display) {
|
|
56482
|
-
var
|
|
56483
|
-
return this.sendMessage((
|
|
56533
|
+
var _classPrivateFieldGet40;
|
|
56534
|
+
return this.sendMessage((_classPrivateFieldGet40 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet40 === void 0 ? void 0 : _classPrivateFieldGet40.handleId, {
|
|
56484
56535
|
body: {
|
|
56485
56536
|
"request": "join",
|
|
56486
56537
|
"room": roomId,
|
|
@@ -56559,9 +56610,9 @@ async function _joinAsSubscriber(roomId, pin, userId) {
|
|
|
56559
56610
|
return _classPrivateFieldGet(_subscriberJoinPromise, this);
|
|
56560
56611
|
}
|
|
56561
56612
|
async function _leaveRoom() {
|
|
56562
|
-
var
|
|
56613
|
+
var _classPrivateFieldGet41;
|
|
56563
56614
|
let dontWait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
56564
|
-
return this.isConnected ? this.sendMessage((
|
|
56615
|
+
return this.isConnected ? this.sendMessage((_classPrivateFieldGet41 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet41 === void 0 ? void 0 : _classPrivateFieldGet41.handleId, {
|
|
56565
56616
|
body: {
|
|
56566
56617
|
"request": "leave"
|
|
56567
56618
|
}
|
|
@@ -56778,14 +56829,14 @@ function _enableDebug2() {
|
|
|
56778
56829
|
this._log = console.log.bind(console);
|
|
56779
56830
|
}
|
|
56780
56831
|
function _getHandle(handleId) {
|
|
56781
|
-
var
|
|
56832
|
+
var _classPrivateFieldGet42, _classPrivateFieldGet43;
|
|
56782
56833
|
let rfid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
56783
56834
|
let userId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
56784
56835
|
let fullUserId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
56785
|
-
if (handleId === ((
|
|
56836
|
+
if (handleId === ((_classPrivateFieldGet42 = _classPrivateFieldGet(_subscriberHandle, this)) === null || _classPrivateFieldGet42 === void 0 ? void 0 : _classPrivateFieldGet42.handleId)) {
|
|
56786
56837
|
return _classPrivateFieldGet(_subscriberHandle, this);
|
|
56787
56838
|
}
|
|
56788
|
-
if (handleId === ((
|
|
56839
|
+
if (handleId === ((_classPrivateFieldGet43 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet43 === void 0 ? void 0 : _classPrivateFieldGet43.handleId)) {
|
|
56789
56840
|
return _classPrivateFieldGet(_publisherHandle, this);
|
|
56790
56841
|
}
|
|
56791
56842
|
return null;
|
|
@@ -56896,20 +56947,20 @@ function _webrtc(handleId) {
|
|
|
56896
56947
|
};
|
|
56897
56948
|
}
|
|
56898
56949
|
config.pc.onconnectionstatechange = () => {
|
|
56899
|
-
var
|
|
56950
|
+
var _classPrivateFieldGet44;
|
|
56900
56951
|
if (config.pc.connectionState === 'failed') {
|
|
56901
56952
|
this._log('onconnectionstatechange: connectionState === failed');
|
|
56902
56953
|
_assertClassBrand(_RoomSession_brand, this, _iceRestart).call(this, handleId);
|
|
56903
56954
|
}
|
|
56904
|
-
this.emit('connectionState', [handleId, handleId === ((
|
|
56955
|
+
this.emit('connectionState', [handleId, handleId === ((_classPrivateFieldGet44 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet44 === void 0 ? void 0 : _classPrivateFieldGet44.handleId), config.pc.connectionState]);
|
|
56905
56956
|
};
|
|
56906
56957
|
config.pc.oniceconnectionstatechange = () => {
|
|
56907
|
-
var
|
|
56958
|
+
var _classPrivateFieldGet45;
|
|
56908
56959
|
if (config.pc.iceConnectionState === 'failed') {
|
|
56909
56960
|
this._log('oniceconnectionstatechange: iceConnectionState === failed');
|
|
56910
56961
|
_assertClassBrand(_RoomSession_brand, this, _iceRestart).call(this, handleId);
|
|
56911
56962
|
}
|
|
56912
|
-
this.emit('iceState', [handleId, handleId === ((
|
|
56963
|
+
this.emit('iceState', [handleId, handleId === ((_classPrivateFieldGet45 = _classPrivateFieldGet(_publisherHandle, this)) === null || _classPrivateFieldGet45 === void 0 ? void 0 : _classPrivateFieldGet45.handleId), config.pc.iceConnectionState]);
|
|
56913
56964
|
};
|
|
56914
56965
|
config.pc.onicecandidate = event => {
|
|
56915
56966
|
if (event.candidate == null || webrtc_adapter__WEBPACK_IMPORTED_MODULE_0__["default"].browserDetails.browser === 'edge' && event.candidate.candidate.indexOf('endOfCandidates') > 0) {
|