@reactoo/watchtogether-sdk-js 2.5.44 → 2.5.50
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.
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
<input type="text" id="instance-type" onchange="applySettingsFromForm()">
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
|
+
<div class="form-group">
|
|
52
|
+
<label for="swagger-url">Swagger URL</label>
|
|
53
|
+
<input type="text" id="swagger-url" onchange="applySettingsFromForm()">
|
|
54
|
+
</div>
|
|
55
|
+
|
|
51
56
|
<div class="form-group">
|
|
52
57
|
<label for="fetch-names">Fetch participants names</label>
|
|
53
58
|
<input type="checkbox" id="fetch-names" onchange="applySettingsFromForm()">
|
|
@@ -95,11 +100,12 @@
|
|
|
95
100
|
participantsOrderRandomization: false,
|
|
96
101
|
minParticipantsCount: 1,
|
|
97
102
|
maxParticipantsCount: 32,
|
|
98
|
-
instanceType: "reactooDemo",
|
|
99
103
|
roomId: "",
|
|
100
104
|
pinHash: "",
|
|
101
105
|
connectionDelay: 1,
|
|
102
106
|
parallelQueues: 1, // number of parallel queues for joining participants - only applied when connectionDelay is 0
|
|
107
|
+
instanceType: "reactooDemo",
|
|
108
|
+
swaggerUrl: "https://api.reactoo.com/v3/swagger.json",
|
|
103
109
|
fetchNames: false,
|
|
104
110
|
participantsNames: [],
|
|
105
111
|
};
|
|
@@ -119,6 +125,7 @@
|
|
|
119
125
|
connectionDelay: document.getElementById("connection-delay"),
|
|
120
126
|
parallelQueues: document.getElementById("parallel-queues"),
|
|
121
127
|
instanceType: document.getElementById("instance-type"),
|
|
128
|
+
swaggerUrl: document.getElementById("swagger-url"),
|
|
122
129
|
fetchNames: document.getElementById("fetch-names"),
|
|
123
130
|
participantsNames: document.getElementById("participants-names"),
|
|
124
131
|
},
|
|
@@ -144,17 +151,18 @@
|
|
|
144
151
|
|
|
145
152
|
function applySettingsFromForm() {
|
|
146
153
|
settings = {
|
|
147
|
-
participantsCount: parseInt(elements.form.participantsCount.value) ||
|
|
154
|
+
participantsCount: parseInt(elements.form.participantsCount.value) || defaultSettings.participantsCount,
|
|
148
155
|
participantsOrderRandomization: elements.form.participantsOrderRandomization.checked,
|
|
149
|
-
minParticipantsCount: parseInt(settings.minParticipantsCount) ||
|
|
150
|
-
maxParticipantsCount: parseInt(settings.maxParticipantsCount) ||
|
|
151
|
-
roomId: elements.form.roomId.value ||
|
|
152
|
-
pinHash: elements.form.pinHash.value ||
|
|
153
|
-
connectionDelay: parseFloat(elements.form.connectionDelay.value) ||
|
|
154
|
-
parallelQueues: parseInt(elements.form.parallelQueues.value) ||
|
|
155
|
-
instanceType: elements.form.instanceType.value ||
|
|
156
|
+
minParticipantsCount: parseInt(settings.minParticipantsCount) || defaultSettings.minParticipantsCount,
|
|
157
|
+
maxParticipantsCount: parseInt(settings.maxParticipantsCount) || defaultSettings.maxParticipantsCount,
|
|
158
|
+
roomId: elements.form.roomId.value || defaultSettings.roomId,
|
|
159
|
+
pinHash: elements.form.pinHash.value || defaultSettings.pinHash,
|
|
160
|
+
connectionDelay: parseFloat(elements.form.connectionDelay.value) || defaultSettings.connectionDelay,
|
|
161
|
+
parallelQueues: parseInt(elements.form.parallelQueues.value) || defaultSettings.parallelQueues,
|
|
162
|
+
instanceType: elements.form.instanceType.value || defaultSettings.instanceType,
|
|
163
|
+
swaggerUrl: elements.form.swaggerUrl.value || defaultSettings.swaggerUrl,
|
|
156
164
|
fetchNames: elements.form.fetchNames.checked,
|
|
157
|
-
participantsNames: elements.form.participantsNames.value.split("\n"),
|
|
165
|
+
participantsNames: elements.form.participantsNames.value.split("\n") || "",
|
|
158
166
|
};
|
|
159
167
|
|
|
160
168
|
setSettingsToUrl(false);
|
|
@@ -201,6 +209,7 @@
|
|
|
201
209
|
elements.form.connectionDelay.value = settings.connectionDelay;
|
|
202
210
|
elements.form.parallelQueues.value = settings.parallelQueues;
|
|
203
211
|
elements.form.instanceType.value = settings.instanceType;
|
|
212
|
+
elements.form.swaggerUrl.value = settings.swaggerUrl;
|
|
204
213
|
elements.form.fetchNames.checked = settings.fetchNames;
|
|
205
214
|
elements.form.participantsNames.value = settings.participantsNames.join("\n");
|
|
206
215
|
}
|
|
@@ -234,7 +243,7 @@
|
|
|
234
243
|
|
|
235
244
|
const gifUrl = `./persons_gifs/${gifId}.gif`;
|
|
236
245
|
const frameIndex = 0;
|
|
237
|
-
const sdkInstance = WatchTogetherSDK({debug:true, storagePrefix: `participant_${gifId}
|
|
246
|
+
const sdkInstance = WatchTogetherSDK({debug: true, storagePrefix: `participant_${gifId}`, apiUrl: settings.swaggerUrl})({instanceType: settings.instanceType});
|
|
238
247
|
|
|
239
248
|
const containerElement = document.createElement('div');
|
|
240
249
|
containerElement.classList.add('participant-container');
|
package/package.json
CHANGED
package/src/models/room.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import roomSession from './room-session';
|
|
4
4
|
import streamingSession from "./streaming-session";
|
|
5
|
+
import {decodeJanusDisplay} from "../modules/wt-utils";
|
|
5
6
|
|
|
6
7
|
let room = function () {
|
|
7
8
|
|
|
@@ -302,7 +303,7 @@ let room = function () {
|
|
|
302
303
|
return roomSessions.find(session => session.roomId === roomId) || null
|
|
303
304
|
},
|
|
304
305
|
getSessionByUserId: (userId) => {
|
|
305
|
-
return roomSessions.find(session => session.userId === userId) || null
|
|
306
|
+
return roomSessions.find(session => decodeJanusDisplay(session.userId)?.userId === userId) || null
|
|
306
307
|
},
|
|
307
308
|
getSessionByStreamId: (streamId) => {
|
|
308
309
|
return roomSessions.find(session => session.streamId === streamId) || null
|
package/src/modules/wt-room.js
CHANGED
|
@@ -98,9 +98,9 @@ class RoomSession {
|
|
|
98
98
|
participant: {
|
|
99
99
|
"watchparty": ['participant', 'talkback'],
|
|
100
100
|
"commentary": ['participant', 'talkback'],
|
|
101
|
-
"videowall": ['host', '
|
|
102
|
-
"videowall-queue": ['host', '
|
|
103
|
-
"videowall-queue-video": ['host', '
|
|
101
|
+
"videowall": ['host', 'talkback', 'observerSolo1', 'observerSolo2', 'observerSolo3'],
|
|
102
|
+
"videowall-queue": ['host', 'talkback', 'observerSolo1', 'observerSolo2', 'observerSolo3'],
|
|
103
|
+
"videowall-queue-video": ['host', 'talkback', 'observerSolo1', 'observerSolo2', 'observerSolo3']
|
|
104
104
|
},
|
|
105
105
|
monitor: {
|
|
106
106
|
"watchparty": ['participant'],
|
|
@@ -123,6 +123,27 @@ class RoomSession {
|
|
|
123
123
|
"videowall-queue": ['participant'],
|
|
124
124
|
"videowall-queue-video": ['participant'],
|
|
125
125
|
},
|
|
126
|
+
observerSolo1: {
|
|
127
|
+
"watchparty": ['participant'],
|
|
128
|
+
"commentary": ['participant'],
|
|
129
|
+
"videowall": ['participant'],
|
|
130
|
+
"videowall-queue": ['participant'],
|
|
131
|
+
"videowall-queue-video": ['participant'],
|
|
132
|
+
},
|
|
133
|
+
observerSolo2: {
|
|
134
|
+
"watchparty": ['participant'],
|
|
135
|
+
"commentary": ['participant'],
|
|
136
|
+
"videowall": ['participant'],
|
|
137
|
+
"videowall-queue": ['participant'],
|
|
138
|
+
"videowall-queue-video": ['participant'],
|
|
139
|
+
},
|
|
140
|
+
observerSolo3: {
|
|
141
|
+
"watchparty": ['participant'],
|
|
142
|
+
"commentary": ['participant'],
|
|
143
|
+
"videowall": ['participant'],
|
|
144
|
+
"videowall-queue": ['participant'],
|
|
145
|
+
"videowall-queue-video": ['participant'],
|
|
146
|
+
},
|
|
126
147
|
host: {
|
|
127
148
|
"watchparty": [],
|
|
128
149
|
"commentary": [],
|
|
@@ -250,6 +271,9 @@ class RoomSession {
|
|
|
250
271
|
case 'monitor':
|
|
251
272
|
return 'addRemoteTalkback';
|
|
252
273
|
case 'observer':
|
|
274
|
+
case 'observerSolo1':
|
|
275
|
+
case 'observerSolo2':
|
|
276
|
+
case 'observerSolo3':
|
|
253
277
|
return 'addRemoteObserver';
|
|
254
278
|
case 'host':
|
|
255
279
|
return 'addRemoteInstructor';
|
|
@@ -283,6 +307,9 @@ class RoomSession {
|
|
|
283
307
|
case 'monitor':
|
|
284
308
|
return 'removeRemoteTalkback';
|
|
285
309
|
case 'observer':
|
|
310
|
+
case 'observerSolo1':
|
|
311
|
+
case 'observerSolo2':
|
|
312
|
+
case 'observerSolo3':
|
|
286
313
|
return 'removeRemoteObserver';
|
|
287
314
|
case 'host':
|
|
288
315
|
return 'removeRemoteInstructor';
|
|
@@ -664,6 +691,7 @@ class RoomSession {
|
|
|
664
691
|
tid: generateUUID(),
|
|
665
692
|
id: handle.handleId,
|
|
666
693
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
694
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
667
695
|
stream: null,
|
|
668
696
|
track: null,
|
|
669
697
|
adding: false,
|
|
@@ -1240,6 +1268,7 @@ class RoomSession {
|
|
|
1240
1268
|
tid: generateUUID(),
|
|
1241
1269
|
id: handle.handleId,
|
|
1242
1270
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1271
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1243
1272
|
stream: config.stream,
|
|
1244
1273
|
track: null,
|
|
1245
1274
|
optional: true,
|
|
@@ -1261,6 +1290,7 @@ class RoomSession {
|
|
|
1261
1290
|
tid: generateUUID(),
|
|
1262
1291
|
id: handle.handleId,
|
|
1263
1292
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1293
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1264
1294
|
stream: config.stream,
|
|
1265
1295
|
track: null,
|
|
1266
1296
|
optional: true,
|
|
@@ -1314,6 +1344,7 @@ class RoomSession {
|
|
|
1314
1344
|
mid,
|
|
1315
1345
|
id: handle.handleId,
|
|
1316
1346
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1347
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1317
1348
|
stream: config.stream,
|
|
1318
1349
|
track: event.track,
|
|
1319
1350
|
constructId: this.constructId,
|
|
@@ -1342,6 +1373,7 @@ class RoomSession {
|
|
|
1342
1373
|
id: handle.handleId,
|
|
1343
1374
|
mid,
|
|
1344
1375
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1376
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1345
1377
|
stream: config.stream,
|
|
1346
1378
|
track: ev.target,
|
|
1347
1379
|
constructId: this.constructId,
|
|
@@ -1368,6 +1400,7 @@ class RoomSession {
|
|
|
1368
1400
|
id: handle.handleId,
|
|
1369
1401
|
mid,
|
|
1370
1402
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1403
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1371
1404
|
stream: config.stream,
|
|
1372
1405
|
kind: ev.target.kind,
|
|
1373
1406
|
track: ev.target,
|
|
@@ -1389,6 +1422,7 @@ class RoomSession {
|
|
|
1389
1422
|
id: handle.handleId,
|
|
1390
1423
|
mid,
|
|
1391
1424
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1425
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1392
1426
|
stream: config.stream,
|
|
1393
1427
|
kind: ev.target.kind,
|
|
1394
1428
|
track: ev.target,
|
|
@@ -1993,6 +2027,7 @@ class RoomSession {
|
|
|
1993
2027
|
tid: generateUUID(),
|
|
1994
2028
|
id: handle.handleId,
|
|
1995
2029
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
2030
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1996
2031
|
track,
|
|
1997
2032
|
stream: config.stream,
|
|
1998
2033
|
adding: true,
|
|
@@ -2006,6 +2041,7 @@ class RoomSession {
|
|
|
2006
2041
|
tid:generateUUID(),
|
|
2007
2042
|
id: handle.handleId,
|
|
2008
2043
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
2044
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
2009
2045
|
track: ev.target,
|
|
2010
2046
|
stream: config.stream,
|
|
2011
2047
|
adding: false,
|
|
@@ -2023,6 +2059,7 @@ class RoomSession {
|
|
|
2023
2059
|
tid: generateUUID(),
|
|
2024
2060
|
id: handle.handleId,
|
|
2025
2061
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
2062
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
2026
2063
|
stream: null,
|
|
2027
2064
|
adding: false,
|
|
2028
2065
|
constructId: this.constructId,
|