@reactoo/watchtogether-sdk-js 2.6.64 → 2.6.65
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
|
@@ -340,16 +340,20 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
340
340
|
return room.setTalkIntercomChannels(groups);
|
|
341
341
|
},
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
return room.
|
|
343
|
+
getTalkIntercomChannels: () => {
|
|
344
|
+
return room._talkIntercomChannels;
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
getUserTalkIntercomChannels: (userId) => {
|
|
348
|
+
return room.getUserTalkIntercomChannels(userId);
|
|
345
349
|
},
|
|
346
350
|
|
|
347
351
|
setListenIntercomChannels: (groups) => {
|
|
348
352
|
return room.setListenIntercomChannels(groups);
|
|
349
353
|
},
|
|
350
354
|
|
|
351
|
-
|
|
352
|
-
return room.
|
|
355
|
+
getListenIntercomChannels: () => {
|
|
356
|
+
return room._listenIntercomChannels;
|
|
353
357
|
},
|
|
354
358
|
|
|
355
359
|
selectSubStream: (handleId, substream) => {
|
package/src/modules/wt-room.js
CHANGED
|
@@ -770,7 +770,6 @@ class RoomSession {
|
|
|
770
770
|
role: decodeJanusDisplay(handle.userId)?.role,
|
|
771
771
|
stream: null,
|
|
772
772
|
streamMap: structuredClone(handle.webrtcStuff?.streamMap),
|
|
773
|
-
talkIntercomChannels: structuredClone(this._talkIntercomChannels),
|
|
774
773
|
source: null,
|
|
775
774
|
track: null,
|
|
776
775
|
adding: false,
|
|
@@ -1425,8 +1424,8 @@ class RoomSession {
|
|
|
1425
1424
|
this._log = console.log.bind(console);
|
|
1426
1425
|
}
|
|
1427
1426
|
|
|
1428
|
-
_getHandle(handleId, rfid = null) {
|
|
1429
|
-
return this._participants.find(p => p.handleId === handleId || (rfid && p.rfid === rfid));
|
|
1427
|
+
_getHandle(handleId, rfid = null, userId = null) {
|
|
1428
|
+
return this._participants.find(p => p.handleId === handleId || (rfid && p.rfid === rfid) || (userId && p.userId === userId));
|
|
1430
1429
|
}
|
|
1431
1430
|
|
|
1432
1431
|
_getStats(type = null) {
|
|
@@ -1504,7 +1503,6 @@ class RoomSession {
|
|
|
1504
1503
|
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1505
1504
|
stream: config.stream,
|
|
1506
1505
|
streamMap: structuredClone(config.streamMap),
|
|
1507
|
-
talkIntercomChannels: structuredClone(this._talkIntercomChannels),
|
|
1508
1506
|
track: null,
|
|
1509
1507
|
source: null,
|
|
1510
1508
|
constructId: this.constructId,
|
|
@@ -1529,7 +1527,6 @@ class RoomSession {
|
|
|
1529
1527
|
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1530
1528
|
stream: config.stream,
|
|
1531
1529
|
streamMap: structuredClone(config.streamMap),
|
|
1532
|
-
talkIntercomChannels: structuredClone(this._talkIntercomChannels),
|
|
1533
1530
|
track: null,
|
|
1534
1531
|
source: null,
|
|
1535
1532
|
constructId: this.constructId,
|
|
@@ -1597,7 +1594,6 @@ class RoomSession {
|
|
|
1597
1594
|
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1598
1595
|
stream: config.stream,
|
|
1599
1596
|
streamMap: structuredClone(config.streamMap),
|
|
1600
|
-
talkIntercomChannels: structuredClone(this._talkIntercomChannels),
|
|
1601
1597
|
source,
|
|
1602
1598
|
track: ev.track,
|
|
1603
1599
|
adding: false,
|
|
@@ -1621,7 +1617,6 @@ class RoomSession {
|
|
|
1621
1617
|
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1622
1618
|
stream: config.stream,
|
|
1623
1619
|
streamMap: structuredClone(config.streamMap),
|
|
1624
|
-
talkIntercomChannels: structuredClone(this._talkIntercomChannels),
|
|
1625
1620
|
source,
|
|
1626
1621
|
track: event.track,
|
|
1627
1622
|
constructId: this.constructId,
|
|
@@ -1655,7 +1650,6 @@ class RoomSession {
|
|
|
1655
1650
|
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1656
1651
|
stream: config.stream,
|
|
1657
1652
|
streamMap: structuredClone(config.streamMap),
|
|
1658
|
-
talkIntercomChannels: structuredClone(this._talkIntercomChannels),
|
|
1659
1653
|
source,
|
|
1660
1654
|
track: ev.target,
|
|
1661
1655
|
adding: false,
|
|
@@ -2460,6 +2454,30 @@ class RoomSession {
|
|
|
2460
2454
|
: Promise.resolve()
|
|
2461
2455
|
}
|
|
2462
2456
|
|
|
2457
|
+
getUserTalkIntercomChannels(userId) {
|
|
2458
|
+
let talkIntercomChannels = []
|
|
2459
|
+
let handle = this._getHandle(null, null, userId);
|
|
2460
|
+
if (handle) {
|
|
2461
|
+
let config = handle.webrtcStuff;
|
|
2462
|
+
talkIntercomChannels = config.tracksMap.reduce((acc, val) => {
|
|
2463
|
+
if(val.description) {
|
|
2464
|
+
try {
|
|
2465
|
+
let description = JSON.parse(val.description);
|
|
2466
|
+
if(description.intercomGroups) {
|
|
2467
|
+
description.intercomGroups.forEach(group => {
|
|
2468
|
+
if(!acc.includes(group)) {
|
|
2469
|
+
acc.push(group);
|
|
2470
|
+
}
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
catch(e) {}
|
|
2475
|
+
}
|
|
2476
|
+
}, []);
|
|
2477
|
+
}
|
|
2478
|
+
return talkIntercomChannels;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2463
2481
|
toggleAudio(value = null, source = 'camera0', mid) {
|
|
2464
2482
|
let handle = this._getHandle(this.handleId);
|
|
2465
2483
|
if (!handle) {
|