ep_webrtc 2.5.35 → 2.5.37
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/.github/workflows/backend-tests.yml +4 -0
- package/.github/workflows/frontend-tests.yml +19 -41
- package/package.json +1 -1
- package/static/css/styles.css +19 -0
- package/static/js/index.js +56 -2
- package/static/tests/frontend-new/helper/utils.ts +145 -0
- package/static/tests/frontend-new/specs/audio_video_on_start.spec.ts +37 -0
- package/static/tests/frontend-new/specs/checkbox.spec.ts +154 -0
- package/static/tests/frontend-new/specs/enable_disable.spec.ts +81 -0
- package/static/tests/frontend-new/specs/errors.spec.ts +165 -0
- package/static/tests/frontend-new/specs/interface_buttons.spec.ts +271 -0
- package/static/tests/frontend-new/specs/race_conditions.spec.ts +301 -0
- package/static/tests/frontend-new/specs/setStream.spec.ts +185 -0
- package/static/tests/frontend/specs/audio_video_on_start.js +0 -35
- package/static/tests/frontend/specs/checkbox.js +0 -107
- package/static/tests/frontend/specs/enable_disable.js +0 -50
- package/static/tests/frontend/specs/errors.js +0 -58
- package/static/tests/frontend/specs/interface_buttons.js +0 -251
- package/static/tests/frontend/specs/race_conditions.js +0 -206
- package/static/tests/frontend/specs/setStream.js +0 -138
- package/static/tests/frontend/utils.js +0 -44
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Generator function that yields the Cartesian product of the given iterables.
|
|
4
|
-
exports.cartesian = function* (head, ...tail) {
|
|
5
|
-
const remainder = tail.length > 0 ? exports.cartesian(...tail) : [[]];
|
|
6
|
-
for (const r of remainder) for (const h of head) yield [h, ...r];
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const makeSilentAudioTrack = () => {
|
|
10
|
-
const ctx = new AudioContext();
|
|
11
|
-
const gain = ctx.createGain();
|
|
12
|
-
const dst = gain.connect(ctx.createMediaStreamDestination());
|
|
13
|
-
return dst.stream.getAudioTracks()[0];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const makeVideoTrack = (constraints) => {
|
|
17
|
-
const canvas = helper.padChrome$.window.document.createElement('canvas');
|
|
18
|
-
const {
|
|
19
|
-
width: {max: widthMax = 160, ideal: widthIdeal} = {},
|
|
20
|
-
height: {max: heightMax = 120, ideal: heightIdeal} = {},
|
|
21
|
-
} = constraints;
|
|
22
|
-
canvas.width = widthIdeal || widthMax;
|
|
23
|
-
canvas.height = heightIdeal || heightMax;
|
|
24
|
-
const ctx = canvas.getContext('2d');
|
|
25
|
-
// Some animation is needed because in some browsers HTMLVideoElement.play() will hang until the
|
|
26
|
-
// canvas is updated. The pad's window.setInterval is called in the hopes that the interval will
|
|
27
|
-
// be automatically stopped once the pad is unloaded.
|
|
28
|
-
helper.padChrome$.window.setInterval(() => {
|
|
29
|
-
ctx.fillStyle = `#${Math.floor(Math.random() * 2 ** 24).toString(16).padStart(6, '0')}`;
|
|
30
|
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
31
|
-
}, 100); // Use a relatively high frame rate to speed up tests.
|
|
32
|
-
return canvas.captureStream().getVideoTracks()[0];
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Creates dummy audio and/or video tracks. Limitations:
|
|
36
|
-
// - Most browsers prohibit audio until there has been some user interaction with the page or
|
|
37
|
-
// the real getUserMedia() has been called.
|
|
38
|
-
exports.fakeGetUserMedia = async ({audio, video}) => {
|
|
39
|
-
if (!audio && !video) throw new DOMException('either audio or video is required', 'TypeError');
|
|
40
|
-
return new MediaStream([
|
|
41
|
-
...(audio ? [makeSilentAudioTrack()] : []),
|
|
42
|
-
...(video ? [makeVideoTrack(video)] : []),
|
|
43
|
-
]);
|
|
44
|
-
};
|