@reactoo/watchtogether-sdk-js 2.6.8 → 2.6.9

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.8",
3
+ "version": "2.6.9",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -2,19 +2,19 @@
2
2
 
3
3
  export default {
4
4
  getUserStream({
5
- hasVideo,
6
- hasAudio = true,
7
- isHd,
8
- aDeviceId,
9
- vDeviceId,
10
- lfps,
11
- autoGainControl = false,
12
- echoCancellation = true,
13
- noiseSuppression = true,
14
- channelCount = 1,
15
- muteAudio = false,
16
- muteVideo = false,
17
- stream = null
5
+ hasVideo,
6
+ hasAudio = true,
7
+ isHd,
8
+ aDeviceId,
9
+ vDeviceId,
10
+ lfps,
11
+ autoGainControl = false,
12
+ echoCancellation = true,
13
+ noiseSuppression = true,
14
+ channelCount = 1,
15
+ muteAudio = false,
16
+ muteVideo = false,
17
+ stream = null
18
18
  } = {}
19
19
  ) {
20
20
 
@@ -48,6 +48,8 @@ export default {
48
48
  const videoTrack = stream.getVideoTracks()[0];
49
49
  const audioTrack = stream.getAudioTracks()[0];
50
50
 
51
+ console.log(stream, videoOnlyConstraints.video, audioOnlyConstraints.audio)
52
+
51
53
  if(videoTrack) {
52
54
  returnPromises.push(videoTrack.applyConstraints(videoOnlyConstraints.video));
53
55
  }
@@ -57,14 +59,8 @@ export default {
57
59
  }
58
60
 
59
61
  return Promise.all(returnPromises).then(() => {
60
- if (muteAudio) {
61
- stream.getAudioTracks().forEach(track => track.enabled = false);
62
- }
63
-
64
- if (muteVideo) {
65
- stream.getVideoTracks().forEach(track => track.enabled = false);
66
- }
67
-
62
+ stream.getAudioTracks().forEach(track => track.enabled = !muteAudio);
63
+ stream.getVideoTracks().forEach(track => track.enabled = !muteVideo);
68
64
  return stream;
69
65
  });
70
66
  }
@@ -72,14 +68,8 @@ export default {
72
68
 
73
69
  return navigator.mediaDevices.getUserMedia(fullConstraints)
74
70
  .then(stream => {
75
- if (muteAudio) {
76
- stream.getAudioTracks().forEach(track => track.enabled = false);
77
- }
78
-
79
- if (muteVideo) {
80
- stream.getVideoTracks().forEach(track => track.enabled = false);
81
- }
82
-
71
+ stream.getAudioTracks().forEach(track => track.enabled = !muteAudio);
72
+ stream.getVideoTracks().forEach(track => track.enabled = !muteVideo);
83
73
  return stream;
84
74
  });
85
75
  }