@reactoo/watchtogether-sdk-js 2.7.4 → 2.7.6
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
package/src/models/utils.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
//TODO: refactor for proper handling of resolution
|
|
3
4
|
|
|
4
5
|
const getUserMediaConstraints = ({
|
|
5
6
|
|
|
6
7
|
hasVideo,
|
|
7
8
|
hasAudio = true,
|
|
8
|
-
isHd,
|
|
9
9
|
aDeviceId,
|
|
10
10
|
vDeviceId,
|
|
11
|
-
lfps,
|
|
12
11
|
autoGainControl = false,
|
|
13
12
|
echoCancellation = true,
|
|
14
13
|
noiseSuppression = true,
|
|
15
|
-
channelCount = 1
|
|
14
|
+
channelCount = 1,
|
|
15
|
+
width = 1280,
|
|
16
|
+
height = 720,
|
|
16
17
|
|
|
17
18
|
}) => {
|
|
18
19
|
|
|
@@ -40,9 +41,9 @@ const getUserMediaConstraints = ({
|
|
|
40
41
|
video: {
|
|
41
42
|
...(vDeviceId && {deviceId: {exact:vDeviceId}}),
|
|
42
43
|
facingMode: {ideal: "user"},
|
|
43
|
-
|
|
44
|
-
width: {ideal:
|
|
45
|
-
height: {ideal:
|
|
44
|
+
frameRate: { ideal: 30, max: 30 },
|
|
45
|
+
width: {ideal: width},
|
|
46
|
+
height: {ideal: height},
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
|
|
@@ -56,13 +57,12 @@ const getUserMediaConstraints = ({
|
|
|
56
57
|
export default {
|
|
57
58
|
//TODO: add more constraints
|
|
58
59
|
applyConstraints({
|
|
59
|
-
isHd,
|
|
60
|
-
lfps,
|
|
61
60
|
autoGainControl = false,
|
|
62
61
|
echoCancellation = true,
|
|
63
62
|
noiseSuppression = true,
|
|
64
63
|
channelCount = 1,
|
|
65
|
-
stream = null
|
|
64
|
+
stream = null,
|
|
65
|
+
width, height
|
|
66
66
|
}) {
|
|
67
67
|
|
|
68
68
|
if(stream) {
|
|
@@ -70,14 +70,14 @@ export default {
|
|
|
70
70
|
let fullConstraints = getUserMediaConstraints({
|
|
71
71
|
hasVideo: true,
|
|
72
72
|
hasAudio: true,
|
|
73
|
-
autoGainControl, echoCancellation, noiseSuppression, channelCount,
|
|
73
|
+
autoGainControl, echoCancellation, noiseSuppression, channelCount, width, height
|
|
74
74
|
});
|
|
75
75
|
let returnPromises = [];
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const videoTrack = stream.getVideoTracks()[0];
|
|
78
|
+
if(videoTrack) {
|
|
79
|
+
returnPromises.push(videoTrack.applyConstraints(fullConstraints.video));
|
|
80
|
+
}
|
|
81
81
|
|
|
82
82
|
const audioTrack = stream.getAudioTracks()[0];
|
|
83
83
|
if(audioTrack) {
|
|
@@ -98,19 +98,19 @@ export default {
|
|
|
98
98
|
hasAudio = true,
|
|
99
99
|
aDeviceId,
|
|
100
100
|
vDeviceId,
|
|
101
|
-
isHd,
|
|
102
|
-
lfps,
|
|
103
101
|
autoGainControl = false,
|
|
104
102
|
echoCancellation = true,
|
|
105
103
|
noiseSuppression = true,
|
|
106
104
|
channelCount = 1,
|
|
107
105
|
muteAudio = false,
|
|
108
106
|
muteVideo = false,
|
|
107
|
+
width = 1280,
|
|
108
|
+
height = 720
|
|
109
109
|
} = {}
|
|
110
110
|
) {
|
|
111
111
|
|
|
112
112
|
let fullConstraints = getUserMediaConstraints({
|
|
113
|
-
hasVideo, hasAudio,
|
|
113
|
+
hasVideo, hasAudio, aDeviceId, vDeviceId, autoGainControl, echoCancellation, noiseSuppression, channelCount, width, height
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
return navigator.mediaDevices.getUserMedia(fullConstraints)
|
|
@@ -160,6 +160,7 @@ export default {
|
|
|
160
160
|
|
|
161
161
|
return navigator.mediaDevices.getUserMedia(fullConstraints);
|
|
162
162
|
},
|
|
163
|
+
|
|
163
164
|
getDisplayMedia() {
|
|
164
165
|
|
|
165
166
|
const constraints = {
|