@reactoo/watchtogether-sdk-js 2.7.16 → 2.7.17

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.
@@ -32,8 +32,8 @@
32
32
 
33
33
  //https://studio.reactoo.com/room/edf441b3-7415-49c4-9557-273cb93bc746/LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE
34
34
 
35
- let roomId = "8cd6d475-629e-4fe7-b89e-ca480940b02e"; // It will create room automatically if not set
36
- let pinHash = null//"OayoOVzK-XmWr-BTID-fVwH-eH44Tn3xSWeR";// '967ca05f-7fab-a205-5913-39393bbbe923';
35
+ let roomId = "c22ada04-6c95-4524-91d8-e915bcef2e61"; // It will create room automatically if not set
36
+ let pinHash = "OayoOVzK-XmWr-BTID-fVwH-eH44Tn3xSWeR";// '967ca05f-7fab-a205-5913-39393bbbe923';
37
37
 
38
38
  let participants = document.querySelector('.participants');
39
39
  var video = document.querySelector('.contentVideo');
@@ -199,7 +199,7 @@
199
199
  console.log('Iot message:', r);
200
200
  });
201
201
 
202
- Instance.auth.providerLogin('observer', 'TPpHTkLL8lfzvFZ4JRww7w6A1pD1h5b~hZDthaj3me9i0jY4AX9ehKv1oVfOa7uKZiHiVzyjfc~RVK_Q~ZG0kui9UAyQR8pJD3P5LCLOAMngnjeU2kIt9io70rbdDg--') // login as browser
202
+ Instance.auth.deviceLogin(true) // login as browser
203
203
  .then(r => Instance.iot.iotLogin()) // login to mqtt
204
204
  .then(r => {
205
205
  if(roomId) {
@@ -224,7 +224,7 @@
224
224
  return r.data;
225
225
  })
226
226
  })
227
- .then(r => Instance.room.createSession({constructId, roomId:r.roomId, pinHash: r.pinHash, role:'observerSolo1', options: {
227
+ .then(r => Instance.room.createSession({constructId, roomId:r.roomId, pinHash: r.pinHash, role:'participant', options: {
228
228
  // simulcast: true,
229
229
  // simulcastSettings: {
230
230
  // "default" : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.7.16",
3
+ "version": "2.7.17",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -1573,8 +1573,8 @@ class RoomSession {
1573
1573
  this._log = console.log.bind(console);
1574
1574
  }
1575
1575
 
1576
- _getHandle(handleId, rfid = null, userId = null) {
1577
- return this._participants.find(p => p.handleId === handleId || (rfid && p.rfid === rfid) || (userId && decodeJanusDisplay(p.userId)?.userId === userId));
1576
+ _getHandle(handleId, rfid = null, userId = null, fullUserId = null) {
1577
+ return this._participants.find(p => p.handleId === handleId || (rfid && p.rfid === rfid) || (userId && decodeJanusDisplay(p.userId)?.userId === userId) || (fullUserId && p.userId === fullUserId));
1578
1578
  }
1579
1579
 
1580
1580
 
@@ -3292,13 +3292,11 @@ class RoomSession {
3292
3292
  let remoteUsersCache = this._remoteUsersCache;
3293
3293
  let handle = this._getHandle(this.handleId);
3294
3294
  // filter out my user id from response and compare it to remoteUsersCache
3295
- participants = participants.filter(p => decodeJanusDisplay(p.id)?.userId !== decodeJanusDisplay(handle.userId)?.userId);
3296
-
3295
+ participants = participants.filter(p => p.id !== handle.userId);
3297
3296
  // get rid of participants that are in participants but not in remoteUsersCache
3298
3297
  remoteUsersCache = remoteUsersCache.filter(r => participants.find(p => p.id === r.id));
3299
3298
  remoteUsersCache.forEach(r => {
3300
- const handle = this._getHandle(null, null, decodeJanusDisplay(r.userId)?.userId);
3301
-
3299
+ const handle = this._getHandle(null, null, null, r.userId);
3302
3300
  if(this._participantShouldSubscribe(r.userId)) {
3303
3301
  // todo: do a nicer flag to indicate inactive handle than just checking for pc
3304
3302
  if(!handle || !handle.webrtcStuff?.pc) {