@reactoo/watchtogether-sdk-js 2.7.8 → 2.7.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.
- package/dist/watchtogether-sdk.js +1783 -201
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +95 -39
- package/package.json +2 -2
- package/src/models/room-session.js +7 -5
- package/src/models/user.js +26 -13
- package/src/modules/wt-room.js +170 -65
package/example/index.html
CHANGED
|
@@ -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 = "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';
|
|
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');
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
return Instance.room.getSessionByConstructId(constructId).selectSubStream(handleId, substream, source);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
function overrideSimulcastSettings(handleId, mid, source, settings) {
|
|
56
|
+
return Instance.room.getSessionByConstructId(constructId).overrideSimulcastSettings(handleId, mid, source, settings);
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
function hento() {
|
|
56
60
|
//Instance.system.getSettings();
|
|
57
61
|
Instance.system.getClient()
|
|
@@ -221,43 +225,95 @@
|
|
|
221
225
|
})
|
|
222
226
|
})
|
|
223
227
|
.then(r => Instance.room.createSession({constructId, roomId:r.roomId, pinHash: r.pinHash, role:'participant', options: {
|
|
224
|
-
simulcast: true,
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
228
|
+
// simulcast: true,
|
|
229
|
+
// simulcastSettings: {
|
|
230
|
+
// "default" : {
|
|
231
|
+
// mode: "controlled", // controlled, manual, browserControlled
|
|
232
|
+
// defaultSubstream: 0, // 2 lowest quality, 0 highest quality
|
|
233
|
+
// bitrates: [
|
|
234
|
+
// {
|
|
235
|
+
// "rid": "l",
|
|
236
|
+
// "active": true,
|
|
237
|
+
// "maxBitrate": 180000,
|
|
238
|
+
// "maxFramerate": 20,
|
|
239
|
+
// "scaleResolutionDownBy": 3.3333333333333335,
|
|
240
|
+
// "priority": "low"
|
|
241
|
+
// },
|
|
242
|
+
// {
|
|
243
|
+
// "rid": "m",
|
|
244
|
+
// "active": true,
|
|
245
|
+
// "maxBitrate": 500000,
|
|
246
|
+
// "maxFramerate": 25,
|
|
247
|
+
// "scaleResolutionDownBy": 1.3333333333333335,
|
|
248
|
+
// "priority": "low"
|
|
249
|
+
// },
|
|
250
|
+
// {
|
|
251
|
+
// "rid": "h",
|
|
252
|
+
// "active": true,
|
|
253
|
+
// "maxBitrate": 2000000,
|
|
254
|
+
// "maxFramerate": 30,
|
|
255
|
+
// "priority": "low"
|
|
256
|
+
// }
|
|
257
|
+
// ]
|
|
258
|
+
// },
|
|
259
|
+
// "*camera*" : {
|
|
260
|
+
// mode: "controlled",
|
|
261
|
+
// defaultSubstream: 0,
|
|
262
|
+
// bitrates: [
|
|
263
|
+
// {
|
|
264
|
+
// "rid": "l",
|
|
265
|
+
// "active": true,
|
|
266
|
+
// "maxBitrate": 180000,
|
|
267
|
+
// "maxFramerate": 20,
|
|
268
|
+
// "scaleResolutionDownBy": 3.3333333333333335,
|
|
269
|
+
// "priority": "low"
|
|
270
|
+
// },
|
|
271
|
+
// {
|
|
272
|
+
// "rid": "m",
|
|
273
|
+
// "active": true,
|
|
274
|
+
// "maxBitrate": 500000,
|
|
275
|
+
// "maxFramerate": 25,
|
|
276
|
+
// "scaleResolutionDownBy": 1.3333333333333335,
|
|
277
|
+
// "priority": "low"
|
|
278
|
+
// },
|
|
279
|
+
// {
|
|
280
|
+
// "rid": "h",
|
|
281
|
+
// "active": true,
|
|
282
|
+
// "maxBitrate": 2000000,
|
|
283
|
+
// "maxFramerate": 30,
|
|
284
|
+
// "priority": "low"
|
|
285
|
+
// }
|
|
286
|
+
// ]
|
|
287
|
+
// },
|
|
288
|
+
// "*screen*": {
|
|
289
|
+
// mode: "manual",
|
|
290
|
+
// defaultSubstream: 0,
|
|
291
|
+
// bitrates: [
|
|
292
|
+
// {
|
|
293
|
+
// "rid": "l",
|
|
294
|
+
// "active": true,
|
|
295
|
+
// "maxBitrate": 270000,
|
|
296
|
+
// "maxFramerate": 5,
|
|
297
|
+
// "scaleResolutionDownBy": 1.3333333333333335,
|
|
298
|
+
// "priority": "low"
|
|
299
|
+
// },
|
|
300
|
+
// {
|
|
301
|
+
// "rid": "m",
|
|
302
|
+
// "active": true,
|
|
303
|
+
// "maxBitrate": 500000,
|
|
304
|
+
// "maxFramerate": 10,
|
|
305
|
+
// "priority": "low"
|
|
306
|
+
// },
|
|
307
|
+
// {
|
|
308
|
+
// "rid": "h",
|
|
309
|
+
// "active": true,
|
|
310
|
+
// "maxBitrate": 2000000,
|
|
311
|
+
// "maxFramerate": 30,
|
|
312
|
+
// "priority": "low"
|
|
313
|
+
// }
|
|
314
|
+
// ]
|
|
315
|
+
// }
|
|
316
|
+
// },
|
|
261
317
|
//subscriptionRules: {participant: {videoWall: [], watchTogether: []}}
|
|
262
318
|
}}))
|
|
263
319
|
.then(session => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactoo/watchtogether-sdk-js",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.10",
|
|
4
4
|
"description": "Javascript SDK for Reactoo",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"unpkg": "dist/watchtogether-sdk.min.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"aws-iot-device-sdk": "^2.2.11",
|
|
46
46
|
"serialize-error": "9.1.0",
|
|
47
47
|
"swagger-client": "3.18.0",
|
|
48
|
-
"webrtc-adapter": "^
|
|
48
|
+
"webrtc-adapter": "^9.0.1"
|
|
49
49
|
},
|
|
50
50
|
"browserslist": [
|
|
51
51
|
"> 0.5%",
|
|
@@ -21,7 +21,7 @@ import syncModule from "../modules/sync-modules/sync-module";
|
|
|
21
21
|
let roomSession = function ({roomId, pinHash, role, options = {}}, room, wt) {
|
|
22
22
|
|
|
23
23
|
let primaryRoomId = roomId;
|
|
24
|
-
let {simulcast = null,
|
|
24
|
+
let {simulcast = null, simulcastSettings = null, enableDtx = null, subscriptionRules = null} = options;
|
|
25
25
|
let publicCustomEvents = ['changePlayerSource', 'chatMessage', 'userUpdate', 'reconnecting', 'connecting', 'remoteMuted', 'scaling'];
|
|
26
26
|
|
|
27
27
|
const addEvents = (events) => {
|
|
@@ -118,10 +118,8 @@ let roomSession = function ({roomId, pinHash, role, options = {}}, room, wt) {
|
|
|
118
118
|
roomData.data.webrtcVersion,
|
|
119
119
|
(roomData.data.bitrate ? parseInt(roomData.data.bitrate) : 0),
|
|
120
120
|
roomData.data.recordingFilename,
|
|
121
|
-
simulcast !== null ? simulcast : roomData?.data?.simulcast,
|
|
122
|
-
|
|
123
|
-
simulcastMode !== null ? simulcastMode : roomData?.data?.simulcast?.mode,
|
|
124
|
-
simulcastDefaultManualSubstream !== null ? simulcastDefaultManualSubstream : roomData?.data?.simulcast?.defaultManualSubstream,
|
|
121
|
+
simulcast !== null ? simulcast : !!roomData?.data?.simulcast,
|
|
122
|
+
simulcastSettings !== null ? simulcastSettings : roomData?.data?.simulcast,
|
|
125
123
|
enableDtx !== null ? enableDtx : roomData?.data?.enableDtx,
|
|
126
124
|
)
|
|
127
125
|
})
|
|
@@ -384,6 +382,10 @@ let roomSession = function ({roomId, pinHash, role, options = {}}, room, wt) {
|
|
|
384
382
|
}).catch(() => null)
|
|
385
383
|
},
|
|
386
384
|
|
|
385
|
+
overrideSimulcastSettings: (handleId, mid, source, settings) => {
|
|
386
|
+
return room.overrideSimulcastSettings(handleId, mid, source, settings);
|
|
387
|
+
},
|
|
388
|
+
|
|
387
389
|
sendSystemMessage: (action, value = {}, to, set_master) => {
|
|
388
390
|
return room.sendMessage(room.handleId, {
|
|
389
391
|
body: {
|
package/src/models/user.js
CHANGED
|
@@ -43,7 +43,7 @@ let user = function () {
|
|
|
43
43
|
.then(([client, response]) => Promise.all([client, response.data.signedUrlSegments.reduce((acc, url, index) => acc.then(() => client.http({url, method: response.data.httpMethod, headers: {"Content-Type":files[index].type}, body:files[index]})), Promise.resolve())]))
|
|
44
44
|
.then(([client]) => client.apis.video.publishVideo({_id:id, roomId}, {requestBody:{_id:id, roomId, privateAttributes}}))
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
getReactionById: (id) => {
|
|
48
48
|
return this.__privates.auth.__client
|
|
49
49
|
.then(client => client.apis.reaction.getReactionById({id}))
|
|
@@ -67,18 +67,31 @@ let user = function () {
|
|
|
67
67
|
.then(client => client.apis.video.getVideoById({id}))
|
|
68
68
|
},
|
|
69
69
|
|
|
70
|
-
getVideos: ({roomId, userId, type, size, startKey, includeUserModels = false, includeRoomQueueStatus} = {}) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
getVideos: ({roomId, userId, type, size, startKey, ids, includeUserModels = false, includeRoomQueueStatus} = {}) => {
|
|
71
|
+
return chunkArray(ids, 50)
|
|
72
|
+
.reduce((promiseChain, idsChunk) => {
|
|
73
|
+
return promiseChain.then(chainResponse => {
|
|
74
|
+
let apiParams = {
|
|
75
|
+
...(roomId && {roomId}),
|
|
76
|
+
...(userId && {userId}),
|
|
77
|
+
...(size && {size}),
|
|
78
|
+
...(idsChunk?.length && {ids: idsChunk.join(',')}),
|
|
79
|
+
...(startKey && {startKey}),
|
|
80
|
+
...(includeRoomQueueStatus && {includeRoomQueueStatus}),
|
|
81
|
+
includeUserModels,
|
|
82
|
+
type
|
|
83
|
+
};
|
|
84
|
+
return this.__privates.auth.__client
|
|
85
|
+
.then(client => client.apis.video.getVideos(apiParams))
|
|
86
|
+
.then(response => type === 'ids' ? {
|
|
87
|
+
data: {
|
|
88
|
+
items: [...chainResponse.data.items, ...response.data.items],
|
|
89
|
+
size: chainResponse.data.size + response.data.size,
|
|
90
|
+
startKey: null,
|
|
91
|
+
},
|
|
92
|
+
} : response);
|
|
93
|
+
});
|
|
94
|
+
}, Promise.resolve({data: {items: [], size: 0, startKey: null}}));
|
|
82
95
|
},
|
|
83
96
|
|
|
84
97
|
deleteVideo: (id) => {
|