@reactoo/watchtogether-sdk-js 2.6.68 → 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.
@@ -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')
@@ -201,15 +206,22 @@
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
227
  // session.setTalkIntercomChannels([]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.68",
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(() => {
@@ -360,8 +363,8 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
360
363
  return room.requestKeyFrame(handleId, mid);
361
364
  },
362
365
 
363
- selectSubStream: (handleId, substream) => {
364
- return room.selectSubStream(handleId, substream);
366
+ selectSubStream: (handleId, substream, source, mid) => {
367
+ return room.selectSubStream(handleId, substream, source, mid);
365
368
  },
366
369
 
367
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);