@reactoo/watchtogether-sdk-js 2.5.9 → 2.5.10
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.
|
@@ -70,11 +70,6 @@
|
|
|
70
70
|
document.getElementById('join-room').setAttribute('disabled', true);
|
|
71
71
|
document.getElementById('joined-participants-count').value = joinedParticipantsCount;
|
|
72
72
|
|
|
73
|
-
// // TODO - toto tu na konci nebude. Je to len preistotu, aby som znova nezhodil server
|
|
74
|
-
// if (participantsCount > 4) {
|
|
75
|
-
// participantsCount = 4;
|
|
76
|
-
// }
|
|
77
|
-
|
|
78
73
|
participantsData = Array(participantsCount).fill(0).map((_, i) => {
|
|
79
74
|
const canvas = document.createElement('canvas');
|
|
80
75
|
const canvasContext = canvas.getContext('2d');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactoo/watchtogether-sdk-js",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.10",
|
|
4
4
|
"description": "Javascript SDK for Reactoo",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"unpkg": "dist/watchtogether-sdk.min.js",
|
|
@@ -42,10 +42,9 @@
|
|
|
42
42
|
"yargs": "^10.1.2"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@fingerprintjs/fingerprintjs": "^
|
|
45
|
+
"@fingerprintjs/fingerprintjs": "^3.3.2",
|
|
46
46
|
"aws-iot-device-sdk": "^2.2.11",
|
|
47
|
-
"
|
|
48
|
-
"serialize-error": "^7.0.1",
|
|
47
|
+
"serialize-error": "^9.1.0",
|
|
49
48
|
"swagger-client": "^3.18.0",
|
|
50
49
|
"webrtc-adapter": "^8.1.1"
|
|
51
50
|
},
|
package/src/models/auth.js
CHANGED
|
@@ -34,8 +34,7 @@ let auth = function () {
|
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
deviceLogin: (salt) => {
|
|
37
|
-
return
|
|
38
|
-
.then(() => getBrowserFingerprint(this.__instanceType, salt))
|
|
37
|
+
return getBrowserFingerprint(this.__instanceType, salt)
|
|
39
38
|
.then( deviceId => Promise.all([deviceId, this.__privates.auth.__client]))
|
|
40
39
|
.then(([deviceId, client]) => client.apis.auth.deviceSignIn({},{requestBody:{deviceId, domain: location.hostname}}))
|
|
41
40
|
.then(response => {
|
|
@@ -19,6 +19,7 @@ import syncUniversal from "../modules/sync-modules/sync-universal";
|
|
|
19
19
|
|
|
20
20
|
let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructor}, room, wt) {
|
|
21
21
|
|
|
22
|
+
let primaryRoomId = roomId;
|
|
22
23
|
let publicCustomEvents = ['changePlayerSource', 'chatMessage', 'userUpdate', 'reconnecting', 'connecting', 'remoteMuted', 'scaling'];
|
|
23
24
|
|
|
24
25
|
const addEvents = (events) => {
|
|
@@ -82,11 +83,11 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
82
83
|
return room._iceRestart(room.handleId);
|
|
83
84
|
},
|
|
84
85
|
|
|
85
|
-
connect: function () {
|
|
86
|
+
connect: function ({reactooRoomId = null} = {}) {
|
|
86
87
|
emitter.emit('connecting', true);
|
|
87
88
|
clearTimeout(alpTimeoutId);
|
|
88
89
|
return Promise.all([wt.room.__joinRoom({
|
|
89
|
-
roomId,
|
|
90
|
+
roomId: reactooRoomId || primaryRoomId,
|
|
90
91
|
pinHash,
|
|
91
92
|
isTalkback,
|
|
92
93
|
isMonitor,
|
|
@@ -94,16 +95,14 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
94
95
|
}), wt.user.getUserSelf()])
|
|
95
96
|
.then(([roomData, userData]) => {
|
|
96
97
|
// Happens when we reroute user to a different room
|
|
97
|
-
if(roomData?.data?.reactooRoomId) {
|
|
98
|
-
roomId = roomData.data.reactooRoomId
|
|
98
|
+
if(roomData?.data?.reactooRoomId !== roomId) {
|
|
99
|
+
roomId = roomData.data.reactooRoomId;
|
|
100
|
+
emitter.emit('changeRoomId', roomId);
|
|
99
101
|
}
|
|
100
102
|
return Promise.all([roomData, userData])
|
|
101
103
|
})
|
|
102
104
|
.then(([roomData, userData]) => Promise.all([roomData, userData, this.setRoomVars()]))
|
|
103
105
|
.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)]))
|
|
104
|
-
.then(([roomData, userData, _]) => {
|
|
105
|
-
return roomData.data
|
|
106
|
-
})
|
|
107
106
|
.finally(() => {
|
|
108
107
|
emitter.emit('connecting', false);
|
|
109
108
|
})
|
|
@@ -116,7 +115,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
116
115
|
},
|
|
117
116
|
|
|
118
117
|
//TODO: refactor restart method
|
|
119
|
-
restart: function (isObserver = false) {
|
|
118
|
+
restart: function ({isObserver = false, reactooRoomId = null} = {}) {
|
|
120
119
|
|
|
121
120
|
emitter.emit('reconnecting', true);
|
|
122
121
|
room.isRestarting = true;
|
|
@@ -130,7 +129,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
130
129
|
|
|
131
130
|
return this.disconnect()
|
|
132
131
|
.then(() => wait(1000)) //TODO: remove 1000ms wait by waiting for proper events from janus
|
|
133
|
-
.then(() => this.connect())
|
|
132
|
+
.then(() => this.connect({reactooRoomId}))
|
|
134
133
|
.then(() => {
|
|
135
134
|
if (isObserver) {
|
|
136
135
|
return this.publishLocal(null, {getStreamIfEmpty: false, unpublishFirst: true});
|
package/src/modules/wt-utils.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FingerprintJs from "@fingerprintjs/fingerprintjs";
|
|
2
2
|
|
|
3
3
|
let wait = function(ms) { return new Promise(resolve => setTimeout(resolve, ms))};
|
|
4
|
-
|
|
4
|
+
let fingerprint = FingerprintJs.load({
|
|
5
|
+
monitoring: false
|
|
6
|
+
})
|
|
5
7
|
let getBrowserFingerprint = function (instanceType = '', salt = '') {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
new Fingerprint2.get(options, (components) => {
|
|
18
|
-
var values = components.map(function (component) { return component.value });
|
|
19
|
-
var murmur = Fingerprint2.x64hash128(values.join(''), 31);
|
|
20
|
-
resolve([8,13,18,23].reduce((acc, cur) => {
|
|
8
|
+
return fingerprint
|
|
9
|
+
.then(fp => fp.get())
|
|
10
|
+
.then(result => {
|
|
11
|
+
const components = {
|
|
12
|
+
...result.components,
|
|
13
|
+
instanceType: { value: instanceType + '_' + salt },
|
|
14
|
+
}
|
|
15
|
+
return [8,13,18,23].reduce((acc, cur) => {
|
|
21
16
|
return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
22
|
-
},
|
|
17
|
+
}, FingerprintJs.hashComponents(components)).substring(0,36)
|
|
23
18
|
})
|
|
24
|
-
});
|
|
25
19
|
};
|
|
26
20
|
|
|
27
21
|
let generateUUID = function () {
|