@reactoo/watchtogether-sdk-js 2.6.11 → 2.6.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.11",
3
+ "version": "2.6.12",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -119,5 +119,37 @@ export default {
119
119
  stream.getVideoTracks().forEach(track => track.enabled = !muteVideo);
120
120
  return stream;
121
121
  });
122
+ },
123
+
124
+ getHostStream({
125
+ hasAudio,
126
+ hasVideo,
127
+ aDeviceId,
128
+ vDeviceId,
129
+ channelCount = 1} = {}
130
+ ) {
131
+
132
+ let audioOnlyConstraints = {
133
+ audio: {
134
+ ...(aDeviceId && {deviceId: {exact:aDeviceId}}),
135
+ channelCount
136
+ }
137
+ };
138
+
139
+ let videoOnlyConstraints = {
140
+ video: {
141
+ ...(vDeviceId && {deviceId: {exact:vDeviceId}}),
142
+ frameRate: {ideal: 30, max: 30},
143
+ width: {min: 1280, ideal: 1920},
144
+ height: {min: 720, ideal: 1080},
145
+ }
146
+ };
147
+
148
+ let fullConstraints = {
149
+ ...(hasAudio ? audioOnlyConstraints : {audio: false}),
150
+ ...(hasVideo ? videoOnlyConstraints : {video: false})
151
+ };
152
+
153
+ return navigator.mediaDevices.getUserMedia(fullConstraints);
122
154
  }
123
155
  }
@@ -1370,6 +1370,7 @@ class RoomSession {
1370
1370
 
1371
1371
  let transceiver = config.pc?.getTransceivers()?.find(
1372
1372
  t => t.receiver.track === ev.target);
1373
+
1373
1374
  let mid = transceiver?.mid || ev.target.id;
1374
1375
 
1375
1376
  if (config.stream) {
@@ -1850,9 +1851,9 @@ class RoomSession {
1850
1851
  direction: 'sendonly',
1851
1852
  streams: [config.stream],
1852
1853
  sendEncodings: [
1853
- { rid: 'h', active: true, maxBitrate: bitRates.high },
1854
- { rid: 'm', active: true, maxBitrate: bitRates.medium, scaleResolutionDownBy: 2 },
1855
- { rid: 'l', active: true, maxBitrate: bitRates.low, scaleResolutionDownBy: 4 }
1854
+ { rid: 'h', active: true, scalabilityMode: 'L1T2', maxBitrate: bitRates.high },
1855
+ { rid: 'm', active: true, scalabilityMode: 'L1T2', maxBitrate: bitRates.medium, scaleResolutionDownBy: 2 },
1856
+ { rid: 'l', active: true, scalabilityMode: 'L1T2', maxBitrate: bitRates.low, scaleResolutionDownBy: 4 }
1856
1857
  ]
1857
1858
  })
1858
1859
  }