@reactoo/watchtogether-sdk-js 2.5.82 → 2.5.85

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.
@@ -25,8 +25,10 @@
25
25
 
26
26
  <script>
27
27
 
28
- let roomId = 'adab485a-548e-44a8-a9ca-157f3ba50c6e'; //It will create room automatically if not set
29
- let pinHash = undefined;//'967ca05f-7fab-a205-5913-39393bbbe923';
28
+ //https://studio.reactoo.com/room/edf441b3-7415-49c4-9557-273cb93bc746/LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE
29
+
30
+ let roomId = 'edf441b3-7415-49c4-9557-273cb93bc746'; //It will create room automatically if not set
31
+ let pinHash = 'LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE';//'967ca05f-7fab-a205-5913-39393bbbe923';
30
32
 
31
33
 
32
34
  let participants = document.querySelector('.participants');
@@ -42,6 +44,10 @@
42
44
  // });
43
45
  // }
44
46
 
47
+ function selectSubStream(handleId, substream) {
48
+ Instance.room.getSessionByConstructId(constructId).selectSubStream(handleId, substream);
49
+ }
50
+
45
51
  function hento() {
46
52
  //Instance.system.getSettings();
47
53
  Instance.system.getClient()
@@ -53,6 +59,8 @@
53
59
 
54
60
  function createParticipant(data, isRemote = false) {
55
61
 
62
+ console.log('participantData', isRemote, data);
63
+
56
64
  let id = `part_${data.id}`;
57
65
  let el = document.querySelector(`.${id}`);
58
66
  if(!el) {
@@ -94,9 +102,10 @@
94
102
  Instance.room.getSessionByConstructId(constructId).unpublishLocal()
95
103
  }
96
104
 
97
- function publish() {
98
- Instance.room.getSessionByConstructId(constructId).publishLocal(null, {unpublishFirst:true})
99
-
105
+ function publish(vDeviceId) {
106
+ let sess = Instance.room.getSessionByConstructId(constructId);
107
+ Instance.utils.getUserStream({hasVideo:true, vDeviceId})
108
+ .then(stream => sess.publishLocal(stream))
100
109
  }
101
110
 
102
111
  function toggleVideo() {
@@ -198,11 +207,11 @@
198
207
  });
199
208
 
200
209
  session.$on('addRemoteParticipant', (participant) => {
201
- createParticipant(participant); // remote stream is available (someone else published himself)
210
+ createParticipant(participant, true); // remote stream is available (someone else published himself)
202
211
  });
203
212
 
204
213
  session.$on('removeRemoteParticipant', (participant) => {
205
- removeParticipant(participant); // remote stream is gone
214
+ removeParticipant(participant, true); // remote stream is gone
206
215
  });
207
216
 
208
217
  session.$on('userUpdate', (userId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.5.82",
3
+ "version": "2.5.85",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -4,11 +4,12 @@ import {generateUUID} from "../modules/wt-utils";
4
4
 
5
5
  let asset = function() {
6
6
  return {
7
- getAssetList: ({type = 'instanceType', instanceType, size = 20, startKey = null, roomId}) => {
7
+ getAssetList: ({type = 'instanceType', instanceType, size = 20, startKey = null, roomId, ids}) => {
8
8
  let apiParams = {
9
+ type,
9
10
  ...(instanceType && {instanceType: instanceType === true ? this.__instanceType : instanceType }),
10
- type,
11
- size,
11
+ ...(size && !ids && {size}),
12
+ ...(ids && {ids: ids.join(',')}),
12
13
  ...(roomId && {roomId}),
13
14
  ...(startKey && {startKey})
14
15
  };
@@ -111,7 +111,10 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
111
111
  roomData.data.userId,
112
112
  roomData.data.webrtcVersion,
113
113
  (roomData.data.bitrate ? parseInt(roomData.data.bitrate) : 0),
114
- roomData.data.recordingFilename)
114
+ roomData.data.recordingFilename,
115
+ roomData.data.simulcast,
116
+ roomData.data.simulcastBitrates || {}
117
+ )
115
118
  })
116
119
  .finally(() => {
117
120
  emitter.emit('connecting', false);
@@ -312,8 +315,8 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
312
315
  }
313
316
  },
314
317
 
315
- publishLocal: function (stream = null, {keepAudio = false, keepVideo = false} = {}) {
316
- return room.publishLocal(stream, {keepAudio, keepVideo})
318
+ publishLocal: function (stream = null) {
319
+ return room.publishLocal(stream)
317
320
  },
318
321
 
319
322
  unpublishLocal: () => {
@@ -328,6 +331,10 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
328
331
  return room.toggleVideo();
329
332
  },
330
333
 
334
+ selectSubStream: (handleId, substream) => {
335
+ return room.selectSubStream(handleId, substream);
336
+ },
337
+
331
338
  setBitrateCap: (bitrate) => {
332
339
  if(role === 'host') {
333
340
  return;