@reactoo/watchtogether-sdk-js 2.6.43 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.43",
3
+ "version": "2.6.44",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -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
  },
@@ -203,6 +203,8 @@ class RoomSession {
203
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;
@@ -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;