@reactoo/watchtogether-sdk-js 2.6.63 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.63",
3
+ "version": "2.6.65",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -340,16 +340,20 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
340
340
  return room.setTalkIntercomChannels(groups);
341
341
  },
342
342
 
343
- getTalkIntercomGroups: () => {
344
- return room._talkIntercomGroups;
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
- getListenIntercomGroups: () => {
352
- return room._listenIntercomGroups;
355
+ getListenIntercomChannels: () => {
356
+ return room._listenIntercomChannels;
353
357
  },
354
358
 
355
359
  selectSubStream: (handleId, substream) => {
@@ -1424,8 +1424,8 @@ class RoomSession {
1424
1424
  this._log = console.log.bind(console);
1425
1425
  }
1426
1426
 
1427
- _getHandle(handleId, rfid = null) {
1428
- 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));
1429
1429
  }
1430
1430
 
1431
1431
  _getStats(type = null) {
@@ -2454,6 +2454,30 @@ class RoomSession {
2454
2454
  : Promise.resolve()
2455
2455
  }
2456
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
+
2457
2481
  toggleAudio(value = null, source = 'camera0', mid) {
2458
2482
  let handle = this._getHandle(this.handleId);
2459
2483
  if (!handle) {