@reactoo/watchtogether-sdk-js 2.7.16 → 2.7.18

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.18",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -866,6 +866,7 @@ class RoomSession {
866
866
  id: handle.handleId,
867
867
  userId: decodeJanusDisplay(handle.userId)?.userId,
868
868
  role: decodeJanusDisplay(handle.userId)?.role,
869
+ fullUserId: handle.userId,
869
870
  stream: null,
870
871
  streamMap: structuredClone(handle.webrtcStuff?.streamMap),
871
872
  tracksMap: structuredClone(handle.webrtcStuff?.tracksMap),
@@ -1029,13 +1030,15 @@ class RoomSession {
1029
1030
  this.emit('removeLocalParticipant', {
1030
1031
  id: handleId,
1031
1032
  userId: decodeJanusDisplay(handle.userId)?.userId,
1032
- role: decodeJanusDisplay(handle.userId)?.role}
1033
+ role: decodeJanusDisplay(handle.userId)?.role,
1034
+ fullUserId: handle.userId}
1033
1035
  );
1034
1036
  } else {
1035
1037
  this.emit(this._getRemoveParticipantEventName(handleId), {
1036
1038
  id: handleId,
1037
1039
  userId: decodeJanusDisplay(handle.userId)?.userId,
1038
- role: decodeJanusDisplay(handle.userId)?.role}
1040
+ role: decodeJanusDisplay(handle.userId)?.role,
1041
+ fullUserId: handle.userId}
1039
1042
  );
1040
1043
  }
1041
1044
 
@@ -1573,8 +1576,8 @@ class RoomSession {
1573
1576
  this._log = console.log.bind(console);
1574
1577
  }
1575
1578
 
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));
1579
+ _getHandle(handleId, rfid = null, userId = null, fullUserId = null) {
1580
+ return this._participants.find(p => p.handleId === handleId || (rfid && p.rfid === rfid) || (userId && decodeJanusDisplay(p.userId)?.userId === userId) || (fullUserId && p.userId === fullUserId));
1578
1581
  }
1579
1582
 
1580
1583
 
@@ -1926,6 +1929,7 @@ class RoomSession {
1926
1929
  id: handle.handleId,
1927
1930
  userId: decodeJanusDisplay(handle.userId)?.userId,
1928
1931
  role: decodeJanusDisplay(handle.userId)?.role,
1932
+ fullUserId: handle.userId,
1929
1933
  stream: config.stream,
1930
1934
  streamMap: structuredClone(config.streamMap),
1931
1935
  tracksMap: structuredClone(config.tracksMap),
@@ -1952,6 +1956,7 @@ class RoomSession {
1952
1956
  id: handle.handleId,
1953
1957
  userId: decodeJanusDisplay(handle.userId)?.userId,
1954
1958
  role: decodeJanusDisplay(handle.userId)?.role,
1959
+ fullUserId: handle.userId,
1955
1960
  stream: config.stream,
1956
1961
  streamMap: structuredClone(config.streamMap),
1957
1962
  tracksMap: structuredClone(config.tracksMap),
@@ -2021,6 +2026,7 @@ class RoomSession {
2021
2026
  constructId: this.constructId,
2022
2027
  userId: decodeJanusDisplay(handle.userId)?.userId,
2023
2028
  role: decodeJanusDisplay(handle.userId)?.role,
2029
+ fullUserId: handle.userId,
2024
2030
  stream: config.stream,
2025
2031
  streamMap: structuredClone(config.streamMap),
2026
2032
  tracksMap: structuredClone(config.tracksMap),
@@ -2049,6 +2055,7 @@ class RoomSession {
2049
2055
  id: handle.handleId,
2050
2056
  userId: decodeJanusDisplay(handle.userId)?.userId,
2051
2057
  role: decodeJanusDisplay(handle.userId)?.role,
2058
+ fullUserId: handle.userId,
2052
2059
  stream: config.stream,
2053
2060
  streamMap: structuredClone(config.streamMap),
2054
2061
  tracksMap: structuredClone(config.tracksMap),
@@ -2084,6 +2091,7 @@ class RoomSession {
2084
2091
  constructId: this.constructId,
2085
2092
  userId: decodeJanusDisplay(handle.userId)?.userId,
2086
2093
  role: decodeJanusDisplay(handle.userId)?.role,
2094
+ fullUserId: handle.userId,
2087
2095
  stream: config.stream,
2088
2096
  streamMap: structuredClone(config.streamMap),
2089
2097
  tracksMap: structuredClone(config.tracksMap),
@@ -2114,6 +2122,7 @@ class RoomSession {
2114
2122
  constructId: this.constructId,
2115
2123
  userId: decodeJanusDisplay(handle.userId)?.userId,
2116
2124
  role: decodeJanusDisplay(handle.userId)?.role,
2125
+ fullUserId: handle.userId,
2117
2126
  stream: config.stream,
2118
2127
  streamMap: structuredClone(config.streamMap),
2119
2128
  source,
@@ -2172,6 +2181,7 @@ class RoomSession {
2172
2181
  constructId: this.constructId,
2173
2182
  userId: decodeJanusDisplay(handle.userId)?.userId,
2174
2183
  role: decodeJanusDisplay(handle.userId)?.role,
2184
+ fullUserId: handle.userId,
2175
2185
  stream: config.stream,
2176
2186
  streamMap: structuredClone(config.streamMap),
2177
2187
  source,
@@ -2936,6 +2946,7 @@ class RoomSession {
2936
2946
 
2937
2947
  getUserTalkIntercomChannels(userId) {
2938
2948
  let talkIntercomChannels = []
2949
+ // TODO: check if we don't need full userId
2939
2950
  let handle = this._getHandle(null, null, userId);
2940
2951
  if (handle) {
2941
2952
  let config = handle.webrtcStuff;
@@ -3292,13 +3303,11 @@ class RoomSession {
3292
3303
  let remoteUsersCache = this._remoteUsersCache;
3293
3304
  let handle = this._getHandle(this.handleId);
3294
3305
  // 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
-
3306
+ participants = participants.filter(p => p.id !== handle.userId);
3297
3307
  // get rid of participants that are in participants but not in remoteUsersCache
3298
3308
  remoteUsersCache = remoteUsersCache.filter(r => participants.find(p => p.id === r.id));
3299
3309
  remoteUsersCache.forEach(r => {
3300
- const handle = this._getHandle(null, null, decodeJanusDisplay(r.userId)?.userId);
3301
-
3310
+ const handle = this._getHandle(null, null, null, r.userId);
3302
3311
  if(this._participantShouldSubscribe(r.userId)) {
3303
3312
  // todo: do a nicer flag to indicate inactive handle than just checking for pc
3304
3313
  if(!handle || !handle.webrtcStuff?.pc) {