ep_webrtc 1.1.0 → 2.0.0
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/README.md +44 -20
- package/index.js +13 -7
- package/package.json +1 -1
- package/static/js/index.js +2 -2
package/README.md
CHANGED
|
@@ -74,20 +74,6 @@ Supported values for `"disabled"`:
|
|
|
74
74
|
* `"soft"`: Initially disabled by default.
|
|
75
75
|
* `"hard"`: Unavailable (it cannot be enabled).
|
|
76
76
|
|
|
77
|
-
The camera's record resolution can be configured by setting `videoConstraints`
|
|
78
|
-
to any [video
|
|
79
|
-
constraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#parameters)
|
|
80
|
-
value acceptable to client browsers. It has the following default value:
|
|
81
|
-
|
|
82
|
-
```json
|
|
83
|
-
"ep_webrtc": {
|
|
84
|
-
"videoConstraints": {
|
|
85
|
-
"width": {"ideal": 160},
|
|
86
|
-
"height": {"ideal": 120}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
77
|
### Custom Activate Button
|
|
92
78
|
|
|
93
79
|
The misnamed `listenClass` setting allows you to specify a CSS selector for an
|
|
@@ -199,10 +185,51 @@ Example:
|
|
|
199
185
|
},
|
|
200
186
|
```
|
|
201
187
|
|
|
188
|
+
### Microphone Settings
|
|
189
|
+
|
|
190
|
+
The microphone can be configured by setting `audio.constraints` to any [audio
|
|
191
|
+
constraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#parameters)
|
|
192
|
+
value acceptable to client browsers. It has the following default value:
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
"ep_webrtc": {
|
|
196
|
+
"audio": {
|
|
197
|
+
"constraints": {
|
|
198
|
+
"autoGainControl": {"ideal": true},
|
|
199
|
+
"echoCancellation": {"ideal": true},
|
|
200
|
+
"noiseSuppression": {"ideal": true}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
For a full list of available constraints, see [the
|
|
207
|
+
standard](https://www.w3.org/TR/2022/CRD-mediacapture-streams-20220307/#constrainable-properties).
|
|
208
|
+
|
|
202
209
|
### Video Sizes
|
|
203
210
|
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
The camera's record resolution can be configured by setting `video.constraints`
|
|
212
|
+
to any [video
|
|
213
|
+
constraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#parameters)
|
|
214
|
+
value acceptable to client browsers. It has the following default value:
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
"ep_webrtc": {
|
|
218
|
+
"video": {
|
|
219
|
+
"constraints": {
|
|
220
|
+
"width": {"ideal": 160},
|
|
221
|
+
"height": {"ideal": 120}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
For a full list of available constraints, see [the
|
|
228
|
+
standard](https://www.w3.org/TR/2022/CRD-mediacapture-streams-20220307/#constrainable-properties).
|
|
229
|
+
|
|
230
|
+
Changing the record resolution does not change the size of the displayed video
|
|
231
|
+
widgets. To change the video widget size, set `video.sizes.small` and/or
|
|
232
|
+
`video.sizes.large`:
|
|
206
233
|
|
|
207
234
|
```json
|
|
208
235
|
"ep_webrtc": {
|
|
@@ -212,12 +239,9 @@ one or both of the following in your `settings.json`:
|
|
|
212
239
|
"large": 400
|
|
213
240
|
}
|
|
214
241
|
}
|
|
215
|
-
}
|
|
242
|
+
},
|
|
216
243
|
```
|
|
217
244
|
|
|
218
|
-
This only controls the size of the video display widget. To set the camera's
|
|
219
|
-
record resolution, see the `videoConstraints` setting.
|
|
220
|
-
|
|
221
245
|
## Metrics
|
|
222
246
|
|
|
223
247
|
You can see metrics for various errors that users have when attempting to
|
package/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const crypto = require('crypto');
|
|
|
20
20
|
const eejs = require('ep_etherpad-lite/node/eejs/');
|
|
21
21
|
const sessioninfos = require('ep_etherpad-lite/node/handler/PadMessageHandler').sessioninfos;
|
|
22
22
|
const stats = require('ep_etherpad-lite/node/stats');
|
|
23
|
+
const util = require('util');
|
|
23
24
|
|
|
24
25
|
let logger = {};
|
|
25
26
|
for (const level of ['debug', 'info', 'warn', 'error']) {
|
|
@@ -30,16 +31,21 @@ const defaultSettings = {
|
|
|
30
31
|
// The defaults here are overridden by the values in the `ep_webrtc` object from `settings.json`.
|
|
31
32
|
enabled: true,
|
|
32
33
|
audio: {
|
|
34
|
+
constraints: {
|
|
35
|
+
autoGainControl: {ideal: true},
|
|
36
|
+
echoCancellation: {ideal: true},
|
|
37
|
+
noiseSuppression: {ideal: true},
|
|
38
|
+
},
|
|
33
39
|
disabled: 'none',
|
|
34
40
|
},
|
|
35
41
|
video: {
|
|
42
|
+
constraints: {
|
|
43
|
+
width: {ideal: 160},
|
|
44
|
+
height: {ideal: 120},
|
|
45
|
+
},
|
|
36
46
|
disabled: 'none',
|
|
37
47
|
sizes: {large: 260, small: 160},
|
|
38
48
|
},
|
|
39
|
-
videoConstraints: {
|
|
40
|
-
width: {ideal: 160},
|
|
41
|
-
height: {ideal: 120},
|
|
42
|
-
},
|
|
43
49
|
iceServers: [{urls: ['stun:stun.l.google.com:19302']}],
|
|
44
50
|
listenClass: null,
|
|
45
51
|
moreInfoUrl: {},
|
|
@@ -225,7 +231,7 @@ exports.eejsBlock_styles = (hookName, context) => {
|
|
|
225
231
|
exports.loadSettings = async (hookName, {settings: {ep_webrtc: s = {}}}) => {
|
|
226
232
|
settings = _.mergeWith({}, defaultSettings, s, (objV, srcV, key, obj, src) => {
|
|
227
233
|
if (Array.isArray(srcV)) return _.cloneDeep(srcV); // Don't merge arrays, replace them.
|
|
228
|
-
if (src === s && key === '
|
|
234
|
+
if (src === s.video && key === 'constraints') return _.cloneDeep(srcV);
|
|
229
235
|
});
|
|
230
236
|
settings.configError = (() => {
|
|
231
237
|
for (const k of ['audio', 'video']) {
|
|
@@ -237,8 +243,8 @@ exports.loadSettings = async (hookName, {settings: {ep_webrtc: s = {}}}) => {
|
|
|
237
243
|
}
|
|
238
244
|
return false;
|
|
239
245
|
})();
|
|
240
|
-
logger.info('configured:', {
|
|
246
|
+
logger.info('configured:', util.inspect({
|
|
241
247
|
...settings,
|
|
242
248
|
iceServers: settings.iceServers.map((s) => s.credential ? {...s, credential: '*****'} : s),
|
|
243
|
-
});
|
|
249
|
+
}, {depth: Infinity}));
|
|
244
250
|
};
|
package/package.json
CHANGED
package/static/js/index.js
CHANGED
|
@@ -668,8 +668,8 @@ exports.rtc = new class {
|
|
|
668
668
|
if (!addAudioTrack && !addVideoTrack) return new MediaStream();
|
|
669
669
|
debug(`requesting permission to access ${devices.join(' and ')}`);
|
|
670
670
|
const stream = await window.navigator.mediaDevices.getUserMedia({
|
|
671
|
-
audio: addAudioTrack,
|
|
672
|
-
video: addVideoTrack && this._settings.
|
|
671
|
+
audio: addAudioTrack && this._settings.audio.constraints,
|
|
672
|
+
video: addVideoTrack && this._settings.video.constraints,
|
|
673
673
|
});
|
|
674
674
|
debug('successfully accessed device(s)');
|
|
675
675
|
return stream;
|