@reactoo/watchtogether-sdk-js 2.6.42 → 2.6.44
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/package.json
CHANGED
|
@@ -336,6 +336,22 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
336
336
|
return room.toggleVideo(value, source);
|
|
337
337
|
},
|
|
338
338
|
|
|
339
|
+
setTalkIntercomGroups: (groups) => {
|
|
340
|
+
return room.setTalkIntercomGroups(groups);
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
getTalkIntercomGroups: () => {
|
|
344
|
+
return room._talkIntercomGroups;
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
setListenIntercomGroups: (groups) => {
|
|
348
|
+
return room.setListenIntercomGroups(groups);
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
getListenIntercomGroups: () => {
|
|
352
|
+
return room._listenIntercomGroups;
|
|
353
|
+
},
|
|
354
|
+
|
|
339
355
|
selectSubStream: (handleId, substream) => {
|
|
340
356
|
return room.selectSubStream(handleId, substream);
|
|
341
357
|
},
|
package/src/modules/wt-room.js
CHANGED
|
@@ -200,9 +200,11 @@ class RoomSession {
|
|
|
200
200
|
this.isStreaming = false;
|
|
201
201
|
|
|
202
202
|
this._retries = 0;
|
|
203
|
-
this._maxRetries =
|
|
203
|
+
this._maxRetries = 5;
|
|
204
204
|
this._keepAliveId = null;
|
|
205
205
|
this._participants = [];
|
|
206
|
+
this._talkIntercomGroups = [];
|
|
207
|
+
this._listenIntercomGroups = [];
|
|
206
208
|
this._roomType = 'watchparty';
|
|
207
209
|
this._isDataChannelOpen = false;
|
|
208
210
|
this._abortController = null;
|
|
@@ -440,7 +442,7 @@ class RoomSession {
|
|
|
440
442
|
|
|
441
443
|
this._keepAliveId = setTimeout(() => {
|
|
442
444
|
this._startKeepAlive();
|
|
443
|
-
},
|
|
445
|
+
}, 10000);
|
|
444
446
|
}
|
|
445
447
|
|
|
446
448
|
_stopKeepAlive() {
|
|
@@ -1062,6 +1064,7 @@ class RoomSession {
|
|
|
1062
1064
|
.then(json => {
|
|
1063
1065
|
this.sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
|
|
1064
1066
|
this._startKeepAlive();
|
|
1067
|
+
this._participants.map(p => this._iceRestart(p.handleId))
|
|
1065
1068
|
this.isReclaiming = false;
|
|
1066
1069
|
this.emit('joining', false);
|
|
1067
1070
|
this._retries = 0;
|
|
@@ -1397,7 +1400,6 @@ class RoomSession {
|
|
|
1397
1400
|
//TODO: check if this isnt fired prematurely when we switch internet connection
|
|
1398
1401
|
if (config.pc.connectionState === 'failed') {
|
|
1399
1402
|
this._log('connectionState failed');
|
|
1400
|
-
this._iceRestart(handleId);
|
|
1401
1403
|
}
|
|
1402
1404
|
this.emit('connectionState', [handleId, handleId === this.handleId, config.pc.connectionState]);
|
|
1403
1405
|
if(handleId !== this.handleId && config.pc.connectionState === 'connected') {
|
|
@@ -2421,6 +2423,43 @@ class RoomSession {
|
|
|
2421
2423
|
}).catch(() => null)
|
|
2422
2424
|
}
|
|
2423
2425
|
|
|
2426
|
+
|
|
2427
|
+
setTalkIntercomGroups(groups = []) {
|
|
2428
|
+
this._talkIntercomGroups = structuredClone(groups);
|
|
2429
|
+
let handle = this._getHandle(this.handleId);
|
|
2430
|
+
if (!handle) {
|
|
2431
|
+
return Promise.reject({
|
|
2432
|
+
type: 'warning',
|
|
2433
|
+
id: 21,
|
|
2434
|
+
message: 'no local id, connect before publishing',
|
|
2435
|
+
data: null
|
|
2436
|
+
})
|
|
2437
|
+
}
|
|
2438
|
+
let config = handle.webrtcStuff;
|
|
2439
|
+
let transceivers = config.pc.getTransceivers();
|
|
2440
|
+
let descriptions = [];
|
|
2441
|
+
Object.keys(config.streamMap).forEach(source => {
|
|
2442
|
+
config.streamMap[source].forEach(trackId => {
|
|
2443
|
+
let t = transceivers.find(transceiver => transceiver.sender.track && transceiver.sender.track.id === trackId)
|
|
2444
|
+
if(t) {
|
|
2445
|
+
descriptions.push({mid: t.mid, description: JSON.stringify({intercomGroups: groups, source:source})});
|
|
2446
|
+
}
|
|
2447
|
+
})
|
|
2448
|
+
});
|
|
2449
|
+
//TODO: under development
|
|
2450
|
+
return Promise.resolve();
|
|
2451
|
+
return this.sendMessage(this.handleId, {
|
|
2452
|
+
body: {
|
|
2453
|
+
"request": "configure",
|
|
2454
|
+
descriptions: descriptions
|
|
2455
|
+
}
|
|
2456
|
+
})
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
setListenIntercomGroups(groups = []) {
|
|
2460
|
+
this._listenIntercomGroups = groups;
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2424
2463
|
setRoomType(type = 'watchparty') {
|
|
2425
2464
|
this._roomType = type;
|
|
2426
2465
|
return this._roomType;
|