@reactoo/watchtogether-sdk-js 2.5.0 → 2.5.4

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.5.0",
3
+ "version": "2.5.4",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -93,7 +93,17 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
93
93
  isInstructor
94
94
  }), wt.user.getUserSelf()])
95
95
  .then(([roomData, userData]) => Promise.all([roomData, userData, this.setRoomVars()]))
96
- .then(([roomData, userData, _]) => room.connect(roomData.data.roomId, roomData.data.pin, roomData.data.href, roomData.data.iceServers, roomData.data.accessToken, (isMonitor || isInstructor || isTalkback) ? roomData.data.userId : userData.data._id, roomData.data.webrtcVersion, (roomData.data.bitrate ? parseInt(roomData.data.bitrate) : 0), isMonitor, roomData.data.recordingFilename))
96
+ .then(([roomData, userData, _]) => Promise.all([roomData, userData, room.connect(roomData.data.roomId, roomData.data.pin, roomData.data.href, roomData.data.iceServers, roomData.data.accessToken, (isMonitor || isInstructor || isTalkback) ? roomData.data.userId : userData.data._id, roomData.data.webrtcVersion, (roomData.data.bitrate ? parseInt(roomData.data.bitrate) : 0), isMonitor, roomData.data.recordingFilename)]))
97
+ .then(([roomData, userData, _]) => {
98
+
99
+ // Happens when we reroute user to a different room
100
+
101
+ if(roomData?.data?.reactooRoomId) {
102
+ roomId = roomData.data.reactooRoomId
103
+ }
104
+
105
+ return roomData.data
106
+ })
97
107
  .finally(() => {
98
108
  emitter.emit('connecting', false);
99
109
  })
@@ -161,6 +171,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
161
171
  } else if (msg.action === 'user_update_displayname' || msg.action === 'user_update_avatar' || msg.action === 'user_update_customattributes' || msg.action === 'user_update_privateattributes') {
162
172
  emitter.emit('userUpdate', msg.text);
163
173
  } else if (msg.action === 'observer_connecting' || msg.action === 'talkback_connecting' || msg.action === 'instructor_connecting') {
174
+
164
175
  this.setRoomVars(null, msg.action === 'observer_connecting').catch(e => {
165
176
  room._log('Setting observers failed, this will cause issues', e);
166
177
  });
@@ -412,7 +412,7 @@ class RoomSession {
412
412
  let subCondition = false
413
413
 
414
414
  if(!isClassroom) {
415
- subscribeCondition = allowedObservers.indexOf(userId) === -1 && allowedTalkback.indexOf(this.userId) === -1;
415
+ subscribeCondition = allowedObservers.indexOf(userId) === -1 && allowedTalkback.indexOf(this.userId) === -1;
416
416
  } else {
417
417
 
418
418
  // instructor -> everyone but observer
@@ -681,6 +681,7 @@ class RoomSession {
681
681
  stream: null,
682
682
  track: null,
683
683
  adding: false,
684
+ constructId: this.constructId,
684
685
  hasAudioTrack: false,
685
686
  hasVideoTrack: false
686
687
  });
@@ -1269,6 +1270,7 @@ class RoomSession {
1269
1270
  userId: handle.userId,
1270
1271
  stream: config.stream,
1271
1272
  track: event.track,
1273
+ constructId: this.constructId,
1272
1274
  adding: true,
1273
1275
  hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),
1274
1276
  hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)
@@ -1302,6 +1304,7 @@ class RoomSession {
1302
1304
  userId: handle.userId,
1303
1305
  stream: config.stream,
1304
1306
  track: ev.target,
1307
+ constructId: this.constructId,
1305
1308
  adding: false,
1306
1309
  hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),
1307
1310
  hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)