@whereby.com/browser-sdk 2.1.0-beta4 → 2.1.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 +48 -43
- package/dist/cdn/{v2-embed-beta4.js → v2-embed.js} +1 -1
- package/dist/cdn/v2-react.js +3 -0
- package/dist/embed/index.esm.js +133 -133
- package/dist/react/index.d.ts +95 -122
- package/dist/react/index.esm.js +3368 -5086
- package/dist/utils/index.esm.js +65 -65
- package/package.json +7 -24
- package/dist/cdn/v2-react-beta4.js +0 -3
- package/dist/core/index.d.ts +0 -2360
- package/dist/core/index.js +0 -62963
package/dist/utils/index.esm.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
function fakeAudioStream() {
|
|
2
|
-
const audioCtx = new AudioContext();
|
|
3
|
-
const oscillator = audioCtx.createOscillator();
|
|
4
|
-
const destination = audioCtx.createMediaStreamDestination();
|
|
5
|
-
oscillator.connect(destination);
|
|
6
|
-
oscillator.frequency.value = 400;
|
|
7
|
-
oscillator.type = "sine";
|
|
8
|
-
setInterval(() => {
|
|
9
|
-
if (oscillator.frequency.value <= 900) {
|
|
10
|
-
oscillator.frequency.value += 10;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
oscillator.frequency.value = 200;
|
|
14
|
-
}
|
|
15
|
-
}, 20);
|
|
16
|
-
oscillator.start();
|
|
17
|
-
return destination.stream;
|
|
1
|
+
function fakeAudioStream() {
|
|
2
|
+
const audioCtx = new AudioContext();
|
|
3
|
+
const oscillator = audioCtx.createOscillator();
|
|
4
|
+
const destination = audioCtx.createMediaStreamDestination();
|
|
5
|
+
oscillator.connect(destination);
|
|
6
|
+
oscillator.frequency.value = 400;
|
|
7
|
+
oscillator.type = "sine";
|
|
8
|
+
setInterval(() => {
|
|
9
|
+
if (oscillator.frequency.value <= 900) {
|
|
10
|
+
oscillator.frequency.value += 10;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
oscillator.frequency.value = 200;
|
|
14
|
+
}
|
|
15
|
+
}, 20);
|
|
16
|
+
oscillator.start();
|
|
17
|
+
return destination.stream;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
let rotationAngle = 0;
|
|
21
|
-
function drawWebcamFrame(canvas) {
|
|
22
|
-
const context = canvas.getContext("2d");
|
|
23
|
-
if (!context) {
|
|
24
|
-
console.error("Canvas context not available");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const wheelRadius = 100;
|
|
28
|
-
const wheelCenterX = canvas.width / 2;
|
|
29
|
-
const wheelCenterY = canvas.height / 2;
|
|
30
|
-
context.fillStyle = "darkgreen";
|
|
31
|
-
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
32
|
-
context.save();
|
|
33
|
-
context.translate(wheelCenterX, wheelCenterY);
|
|
34
|
-
context.rotate(rotationAngle);
|
|
35
|
-
const numSlices = 12;
|
|
36
|
-
const sliceAngle = (2 * Math.PI) / numSlices;
|
|
37
|
-
const colors = ["red", "orange", "yellow", "green", "blue", "purple"];
|
|
38
|
-
for (let i = 0; i < numSlices; i++) {
|
|
39
|
-
context.beginPath();
|
|
40
|
-
context.moveTo(0, 0);
|
|
41
|
-
context.arc(0, 0, wheelRadius, i * sliceAngle, (i + 1) * sliceAngle);
|
|
42
|
-
context.fillStyle = colors[i % colors.length];
|
|
43
|
-
context.fill();
|
|
44
|
-
context.closePath();
|
|
45
|
-
}
|
|
46
|
-
context.restore();
|
|
47
|
-
context.fillStyle = "white";
|
|
48
|
-
context.font = "42px Arial";
|
|
49
|
-
const topText = "Whereby Media Stream";
|
|
50
|
-
const topTextWidth = context.measureText(topText).width;
|
|
51
|
-
context.fillText(topText, canvas.width / 2 - topTextWidth / 2, 50);
|
|
52
|
-
context.font = "32px Arial";
|
|
53
|
-
const now = new Date();
|
|
54
|
-
const timeText = `time: ${now.getHours().toString().padStart(2, "0")}:${now
|
|
55
|
-
.getMinutes()
|
|
56
|
-
.toString()
|
|
57
|
-
.padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}.${now
|
|
58
|
-
.getMilliseconds()
|
|
59
|
-
.toString()
|
|
60
|
-
.padStart(3, "0")}`;
|
|
61
|
-
context.fillText(timeText, 10, canvas.height - 20);
|
|
62
|
-
context.fillText(`rotation angle: ${rotationAngle.toFixed(2)}`, canvas.width - canvas.width / 2, canvas.height - 20);
|
|
63
|
-
rotationAngle += 0.01;
|
|
64
|
-
}
|
|
65
|
-
function fakeWebcamFrame(canvas) {
|
|
66
|
-
drawWebcamFrame(canvas);
|
|
67
|
-
requestAnimationFrame(() => fakeWebcamFrame(canvas));
|
|
20
|
+
let rotationAngle = 0;
|
|
21
|
+
function drawWebcamFrame(canvas) {
|
|
22
|
+
const context = canvas.getContext("2d");
|
|
23
|
+
if (!context) {
|
|
24
|
+
console.error("Canvas context not available");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const wheelRadius = 100;
|
|
28
|
+
const wheelCenterX = canvas.width / 2;
|
|
29
|
+
const wheelCenterY = canvas.height / 2;
|
|
30
|
+
context.fillStyle = "darkgreen";
|
|
31
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
32
|
+
context.save();
|
|
33
|
+
context.translate(wheelCenterX, wheelCenterY);
|
|
34
|
+
context.rotate(rotationAngle);
|
|
35
|
+
const numSlices = 12;
|
|
36
|
+
const sliceAngle = (2 * Math.PI) / numSlices;
|
|
37
|
+
const colors = ["red", "orange", "yellow", "green", "blue", "purple"];
|
|
38
|
+
for (let i = 0; i < numSlices; i++) {
|
|
39
|
+
context.beginPath();
|
|
40
|
+
context.moveTo(0, 0);
|
|
41
|
+
context.arc(0, 0, wheelRadius, i * sliceAngle, (i + 1) * sliceAngle);
|
|
42
|
+
context.fillStyle = colors[i % colors.length];
|
|
43
|
+
context.fill();
|
|
44
|
+
context.closePath();
|
|
45
|
+
}
|
|
46
|
+
context.restore();
|
|
47
|
+
context.fillStyle = "white";
|
|
48
|
+
context.font = "42px Arial";
|
|
49
|
+
const topText = "Whereby Media Stream";
|
|
50
|
+
const topTextWidth = context.measureText(topText).width;
|
|
51
|
+
context.fillText(topText, canvas.width / 2 - topTextWidth / 2, 50);
|
|
52
|
+
context.font = "32px Arial";
|
|
53
|
+
const now = new Date();
|
|
54
|
+
const timeText = `time: ${now.getHours().toString().padStart(2, "0")}:${now
|
|
55
|
+
.getMinutes()
|
|
56
|
+
.toString()
|
|
57
|
+
.padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}.${now
|
|
58
|
+
.getMilliseconds()
|
|
59
|
+
.toString()
|
|
60
|
+
.padStart(3, "0")}`;
|
|
61
|
+
context.fillText(timeText, 10, canvas.height - 20);
|
|
62
|
+
context.fillText(`rotation angle: ${rotationAngle.toFixed(2)}`, canvas.width - canvas.width / 2, canvas.height - 20);
|
|
63
|
+
rotationAngle += 0.01;
|
|
64
|
+
}
|
|
65
|
+
function fakeWebcamFrame(canvas) {
|
|
66
|
+
drawWebcamFrame(canvas);
|
|
67
|
+
requestAnimationFrame(() => fakeWebcamFrame(canvas));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export { fakeAudioStream, fakeWebcamFrame };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/browser-sdk",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Modules for integration Whereby video in web apps",
|
|
5
5
|
"author": "Whereby AS",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
12
12
|
"source": "src/index.js",
|
|
13
13
|
"exports": {
|
|
14
|
-
"./core": {
|
|
15
|
-
"import": "./dist/core/index.js",
|
|
16
|
-
"types": "./dist/core/index.d.ts"
|
|
17
|
-
},
|
|
18
14
|
"./react": {
|
|
19
15
|
"import": "./dist/react/index.esm.js",
|
|
20
16
|
"types": "./dist/react/index.d.ts"
|
|
@@ -30,9 +26,6 @@
|
|
|
30
26
|
},
|
|
31
27
|
"typesVersions": {
|
|
32
28
|
"*": {
|
|
33
|
-
"core": [
|
|
34
|
-
"dist/core/index.d.ts"
|
|
35
|
-
],
|
|
36
29
|
"react": [
|
|
37
30
|
"dist/react/index.d.ts"
|
|
38
31
|
],
|
|
@@ -53,13 +46,10 @@
|
|
|
53
46
|
"build": "rollup -c rollup.config.js",
|
|
54
47
|
"build:storybook": "storybook build",
|
|
55
48
|
"dev": "storybook dev -p 6006",
|
|
56
|
-
"install:e2e-sample-app": "cd test/sample-app && yarn custom_install",
|
|
57
|
-
"start:e2e-sample-app": "cd test/sample-app && yarn start",
|
|
58
49
|
"test": "yarn test:lint && yarn test:unit",
|
|
59
50
|
"test:lint": "eslint src/",
|
|
60
|
-
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
61
|
-
"test:unit:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
62
|
-
"test:e2e": "playwright test",
|
|
51
|
+
"test:unit": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
|
|
52
|
+
"test:unit:watch": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js --watch",
|
|
63
53
|
"storybook": "storybook dev -p 6006",
|
|
64
54
|
"build-storybook": "storybook build"
|
|
65
55
|
},
|
|
@@ -69,7 +59,6 @@
|
|
|
69
59
|
"@babel/preset-env": "^7.23.2",
|
|
70
60
|
"@babel/preset-react": "^7.22.15",
|
|
71
61
|
"@babel/preset-typescript": "^7.23.2",
|
|
72
|
-
"@playwright/test": "^1.38.1",
|
|
73
62
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
74
63
|
"@rollup/plugin-json": "^6.0.1",
|
|
75
64
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -82,20 +71,13 @@
|
|
|
82
71
|
"@testing-library/react": "^14.0.0",
|
|
83
72
|
"@types/btoa": "^1.2.3",
|
|
84
73
|
"@types/chrome": "^0.0.210",
|
|
85
|
-
"@types/jest": "^29.2.4",
|
|
86
74
|
"@types/node": "^20.7.1",
|
|
87
75
|
"@types/react": "^18.0.26",
|
|
88
76
|
"@types/uuid": "^9.0.7",
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
90
|
-
"@typescript-eslint/parser": "^5.46.1",
|
|
91
77
|
"babel-loader": "^8.2.5",
|
|
92
78
|
"deep-object-diff": "^1.1.9",
|
|
93
79
|
"dotenv": "^16.3.1",
|
|
94
80
|
"dotenv-run-script": "^0.4.1",
|
|
95
|
-
"eslint": "^8.29.0",
|
|
96
|
-
"eslint-plugin-jest": "^26.5.3",
|
|
97
|
-
"jest": "29.4.3",
|
|
98
|
-
"jest-environment-jsdom": "29.4.3",
|
|
99
81
|
"lit-html": "^2.5.0",
|
|
100
82
|
"prettier": "^2.7.1",
|
|
101
83
|
"react": "^18.2.0",
|
|
@@ -107,16 +89,14 @@
|
|
|
107
89
|
"rollup-plugin-terser": "^7.0.2",
|
|
108
90
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
109
91
|
"storybook": "^7.5.2",
|
|
110
|
-
"ts-jest": "29.0.5",
|
|
111
92
|
"tslib": "^2.4.1",
|
|
112
|
-
"typescript": "^4.9.4",
|
|
113
93
|
"uuid": "^9.0.1",
|
|
114
94
|
"yalc": "^1.0.0-pre.53"
|
|
115
95
|
},
|
|
116
96
|
"dependencies": {
|
|
117
97
|
"@reduxjs/toolkit": "^2.0.1",
|
|
118
98
|
"@swc/helpers": "^0.3.13",
|
|
119
|
-
"@whereby/jslib-media": "whereby/jslib-media.git#1.
|
|
99
|
+
"@whereby/jslib-media": "whereby/jslib-media.git#1.4.1",
|
|
120
100
|
"axios": "^1.2.3",
|
|
121
101
|
"btoa": "^1.2.1",
|
|
122
102
|
"events": "^3.3.0",
|
|
@@ -130,5 +110,8 @@
|
|
|
130
110
|
"string-width": "^4",
|
|
131
111
|
"jackspeak": "2.1.1",
|
|
132
112
|
"wrap-ansi": "7.0.0"
|
|
113
|
+
},
|
|
114
|
+
"publishConfig": {
|
|
115
|
+
"access": "public"
|
|
133
116
|
}
|
|
134
117
|
}
|