@reactoo/watchtogether-sdk-js 2.6.67 → 2.6.69

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.
Files changed (44) hide show
  1. package/dist/watchtogether-sdk.js +6 -6
  2. package/dist/watchtogether-sdk.min.js +2 -2
  3. package/example/bulk_join_room/bulk_join_room.html +30 -30
  4. package/example/bulk_join_room/bulk_join_room_2.css +6 -1
  5. package/example/bulk_join_room/bulk_join_room_2.html +304 -137
  6. package/example/bulk_join_room/sound_empty.mp3 +0 -0
  7. package/example/index.html +26 -14
  8. package/package.json +1 -1
  9. package/src/models/room-session.js +12 -5
  10. package/src/models/room.js +1 -0
  11. package/src/modules/wt-room.js +504 -51
  12. package/src/modules/wt-utils.js +29 -1
  13. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/1.gif +0 -0
  14. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/10.gif +0 -0
  15. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/11.gif +0 -0
  16. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/12.gif +0 -0
  17. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/13.gif +0 -0
  18. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/14.gif +0 -0
  19. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/15.gif +0 -0
  20. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/16.gif +0 -0
  21. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/17.gif +0 -0
  22. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/18.gif +0 -0
  23. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/19.gif +0 -0
  24. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/2.gif +0 -0
  25. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/20.gif +0 -0
  26. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/21.gif +0 -0
  27. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/22.gif +0 -0
  28. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/23.gif +0 -0
  29. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/24.gif +0 -0
  30. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/25.gif +0 -0
  31. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/26.gif +0 -0
  32. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/27.gif +0 -0
  33. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/28.gif +0 -0
  34. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/29.gif +0 -0
  35. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/3.gif +0 -0
  36. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/30.gif +0 -0
  37. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/31.gif +0 -0
  38. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/32.gif +0 -0
  39. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/4.gif +0 -0
  40. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/5.gif +0 -0
  41. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/6.gif +0 -0
  42. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/7.gif +0 -0
  43. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/8.gif +0 -0
  44. /package/example/bulk_join_room/{persons_gifs → persons_gifs_lq}/9.gif +0 -0
@@ -14,8 +14,9 @@
14
14
  <button onclick="startRoom()">Connect and publish</button>
15
15
  <button onclick="startRoom2()">Connect and publish with screen share</button>
16
16
  <button onclick="disconnectRoom()">Disconnect</button>
17
- <button onclick="publish()">publish</button>
18
- <button onclick="publishBlank()">publish blank</button>
17
+ <button onclick="publish()">publish cam</button>
18
+ <button onclick="publishBlankCam()">publish blank cam</button>
19
+ <button onclick="publishBlank()">publish blank screen</button>
19
20
  <button onclick="publishScreen()">publish screen</button>
20
21
  <button onclick="unpublish()">unpublish</button>
21
22
  <button onclick="toggleVideo()">toggle video</button>
@@ -33,7 +34,6 @@
33
34
  let roomId = "c22ada04-6c95-4524-91d8-e915bcef2e61"; //It will create room automatically if not set
34
35
  let pinHash = "OayoOVzK-XmWr-BTID-fVwH-eH44Tn3xSWeR";//'967ca05f-7fab-a205-5913-39393bbbe923';
35
36
 
36
-
37
37
  let participants = document.querySelector('.participants');
38
38
  var video = document.querySelector('.contentVideo');
39
39
  let constructId = 'test';
@@ -47,8 +47,8 @@
47
47
  // });
48
48
  // }
49
49
 
50
- function selectSubStream(handleId, substream) {
51
- Instance.room.getSessionByConstructId(constructId).selectSubStream(handleId, substream);
50
+ function selectSubStream(handleId, substream, source) {
51
+ return Instance.room.getSessionByConstructId(constructId).selectSubStream(handleId, substream, source);
52
52
  }
53
53
 
54
54
  function hento() {
@@ -107,7 +107,7 @@
107
107
  function startRoom() {
108
108
  let sess = Instance.room.getSessionByConstructId(constructId);
109
109
  sess.connect()
110
- .then(() => Instance.utils.getUserStream({hasVideo:true, hasAudio: true}))
110
+ .then(() => Instance.utils.getUserStream({hasVideo:true, hasAudio: true, isHd: true}))
111
111
  .then((stream) => sess.publishLocal(stream))
112
112
  }
113
113
 
@@ -124,6 +124,11 @@
124
124
  Instance.room.getSessionByConstructId(constructId).unpublishLocal()
125
125
  }
126
126
 
127
+ function publishBlankCam() {
128
+ let sess = Instance.room.getSessionByConstructId(constructId);
129
+ sess.publishLocal(null, 'camera0')
130
+ }
131
+
127
132
  function publishBlank() {
128
133
  let sess = Instance.room.getSessionByConstructId(constructId);
129
134
  sess.publishLocal(null, 'screen')
@@ -157,7 +162,7 @@
157
162
  Instance.room.getSessionByConstructId(constructId).setTalkIntercomChannels(groups)
158
163
  }
159
164
 
160
- let Instance = WatchTogetherSDK({debug:true, apiUrl: 'https://api.reactoo.com/stefan/swagger.json'})({instanceType:'reactooDemo'});
165
+ let Instance = WatchTogetherSDK({debug:true})({instanceType:'reactooDemo'});
161
166
 
162
167
  Instance.auth.$on('login', () => {
163
168
  console.log('We are in');
@@ -201,19 +206,26 @@
201
206
  console.log('roomId:', r.data.roomId);
202
207
  console.log('pinHash:', r.data.pinHash);
203
208
  console.log('-----------------------------------------------------');
204
-
205
209
  return r.data;
206
210
  })
207
-
208
211
  })
209
212
  .then(r => Instance.room.createSession({constructId, roomId:r.roomId, pinHash: r.pinHash, role:'participant', options: {
210
- //subscriptionRules: {participant: {videoWall: [], watchTogether: []}}
211
- //restrictSources: ['camera0']
212
- }})) // pin hash is not needed if you're owner of the room
213
+ simulcast: true,
214
+ simulcastMode: {default: 'controlled', screen: 'manual'},
215
+ simulcastDefaultManualSubstream: {default:2, screen: 0},
216
+ simulcastBitrates: [
217
+ { rid: 'l', active: true, maxBitrate: 180000, maxFramerate: 2, scaleResolutionDownBy: 3.3333333333333335, priority: "low" },
218
+ { rid: 'm', active: true, maxBitrate: 800000, maxFramerate: 25, scaleResolutionDownBy: 1.3333333333333333, priority: "low" },
219
+ { rid: 'h', active: true, maxBitrate: 1700000, maxFramerate: 30, priority: "low" }
220
+ ],
221
+ // simulcastMode: 'manual',
222
+ // simulcastDefaultManualSubstream: 2 // lowest quality
223
+ //subscriptionRules: {participant: {videoWall: [], watchTogether: []}}
224
+ }}))
213
225
  .then(session => {
214
226
 
215
- session.setTalkIntercomChannels([]);
216
- session.setListenIntercomChannels([]);
227
+ // session.setTalkIntercomChannels([]);
228
+ // session.setListenIntercomChannels([]);
217
229
 
218
230
  session.$on('connecting', (status) => {
219
231
  console.log('connecting', status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.67",
3
+ "version": "2.6.69",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -18,9 +18,10 @@ import syncDaznDash from "../modules/sync-modules/sync-dazn-dash";
18
18
  import syncDazn from "../modules/sync-modules/sync-dazn";
19
19
  import syncModule from "../modules/sync-modules/sync-module";
20
20
 
21
- let roomSession = function ({roomId, pinHash, role}, room, wt) {
21
+ let roomSession = function ({roomId, pinHash, role, options = {}}, room, wt) {
22
22
 
23
23
  let primaryRoomId = roomId;
24
+ let {simulcast, simulcastBitrates, simulcastMode, simulcastDefaultManualSubstream} = options;
24
25
  let publicCustomEvents = ['changePlayerSource', 'chatMessage', 'userUpdate', 'reconnecting', 'connecting', 'remoteMuted', 'scaling'];
25
26
 
26
27
  const addEvents = (events) => {
@@ -117,8 +118,10 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
117
118
  roomData.data.webrtcVersion,
118
119
  (roomData.data.bitrate ? parseInt(roomData.data.bitrate) : 0),
119
120
  roomData.data.recordingFilename,
120
- roomData.data.simulcast,
121
- roomData.data.simulcastBitrates || {}
121
+ simulcast !== null ? simulcast : roomData.data.simulcast,
122
+ simulcastBitrates !== null ? simulcastBitrates : roomData.data.simulcastBitrates,
123
+ simulcastMode !== null ? simulcastMode : roomData.data.simulcastMode,
124
+ simulcastDefaultManualSubstream !== null ? simulcastDefaultManualSubstream : roomData.data.simulcastDefaultManualSubstream,
122
125
  )
123
126
  })
124
127
  .finally(() => {
@@ -356,8 +359,12 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
356
359
  return room._listenIntercomChannels;
357
360
  },
358
361
 
359
- selectSubStream: (handleId, substream) => {
360
- return room.selectSubStream(handleId, substream);
362
+ requestKeyFrame: (handleId, mid) => {
363
+ return room.requestKeyFrame(handleId, mid);
364
+ },
365
+
366
+ selectSubStream: (handleId, substream, source, mid) => {
367
+ return room.selectSubStream(handleId, substream, source, mid);
361
368
  },
362
369
 
363
370
  setBitrateCap: (bitrate) => {
@@ -274,6 +274,7 @@ let room = function () {
274
274
  roomId,
275
275
  pinHash,
276
276
  role,
277
+ options
277
278
  }, lib.createSession(constructId, 'reactooroom', options), this))
278
279
  .then(newSession => {
279
280
  let existingSessionIndex = roomSessions.findIndex(session => session.constructId === newSession.constructId);