@whereby.com/browser-sdk 2.1.0 → 2.2.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/dist/cdn/v2-embed.js +2 -2
- package/dist/cdn/v2-react.js +2 -2
- package/dist/embed/index.esm.js +3 -27
- package/dist/react/index.d.ts +9 -721
- package/dist/react/index.esm.js +40 -8637
- package/package.json +12 -23
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.esm.js +0 -70
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/browser-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Modules for integration Whereby video in web apps",
|
|
5
5
|
"author": "Whereby AS",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/whereby/
|
|
9
|
+
"url": "https://github.com/whereby/sdk.git",
|
|
10
|
+
"directory": "packages/browser-sdk"
|
|
10
11
|
},
|
|
11
12
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
12
13
|
"source": "src/index.js",
|
|
@@ -18,10 +19,6 @@
|
|
|
18
19
|
"./embed": {
|
|
19
20
|
"import": "./dist/embed/index.esm.js",
|
|
20
21
|
"types": "./dist/embed/index.d.ts"
|
|
21
|
-
},
|
|
22
|
-
"./utils": {
|
|
23
|
-
"import": "./dist/utils/index.esm.js",
|
|
24
|
-
"types": "./dist/utils/index.d.ts"
|
|
25
22
|
}
|
|
26
23
|
},
|
|
27
24
|
"typesVersions": {
|
|
@@ -31,9 +28,6 @@
|
|
|
31
28
|
],
|
|
32
29
|
"embed": [
|
|
33
30
|
"dist/embed/index.d.ts"
|
|
34
|
-
],
|
|
35
|
-
"utils": [
|
|
36
|
-
"dist/utils/index.d.ts"
|
|
37
31
|
]
|
|
38
32
|
}
|
|
39
33
|
},
|
|
@@ -64,31 +58,29 @@
|
|
|
64
58
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
65
59
|
"@rollup/plugin-replace": "^5.0.5",
|
|
66
60
|
"@storybook/addon-actions": "^7.5.2",
|
|
67
|
-
"@storybook/addon-essentials": "^7.
|
|
68
|
-
"@storybook/addon-links": "^7.
|
|
61
|
+
"@storybook/addon-essentials": "^7.6.13",
|
|
62
|
+
"@storybook/addon-links": "^7.6.14",
|
|
69
63
|
"@storybook/react": "^7.5.2",
|
|
70
|
-
"@storybook/react-webpack5": "^7.
|
|
64
|
+
"@storybook/react-webpack5": "^7.6.16",
|
|
71
65
|
"@testing-library/react": "^14.0.0",
|
|
72
|
-
"@types/btoa": "^1.2.3",
|
|
73
66
|
"@types/chrome": "^0.0.210",
|
|
74
|
-
"@types/node": "^20.
|
|
75
|
-
"@types/react": "^18.
|
|
67
|
+
"@types/node": "^20.11.19",
|
|
68
|
+
"@types/react": "^18.2.55",
|
|
76
69
|
"@types/uuid": "^9.0.7",
|
|
77
70
|
"babel-loader": "^8.2.5",
|
|
78
71
|
"deep-object-diff": "^1.1.9",
|
|
79
72
|
"dotenv": "^16.3.1",
|
|
80
73
|
"dotenv-run-script": "^0.4.1",
|
|
81
74
|
"lit-html": "^2.5.0",
|
|
82
|
-
"prettier": "^2.7.1",
|
|
83
75
|
"react": "^18.2.0",
|
|
84
76
|
"react-dom": "^18.2.0",
|
|
85
|
-
"rimraf": "^
|
|
86
|
-
"rollup": "^4.
|
|
77
|
+
"rimraf": "^5.0.5",
|
|
78
|
+
"rollup": "^4.12.0",
|
|
87
79
|
"rollup-plugin-dts": "^6.1.0",
|
|
88
80
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
89
81
|
"rollup-plugin-terser": "^7.0.2",
|
|
90
82
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
91
|
-
"storybook": "^7.
|
|
83
|
+
"storybook": "^7.6.16",
|
|
92
84
|
"tslib": "^2.4.1",
|
|
93
85
|
"uuid": "^9.0.1",
|
|
94
86
|
"yalc": "^1.0.0-pre.53"
|
|
@@ -96,10 +88,7 @@
|
|
|
96
88
|
"dependencies": {
|
|
97
89
|
"@reduxjs/toolkit": "^2.0.1",
|
|
98
90
|
"@swc/helpers": "^0.3.13",
|
|
99
|
-
"@whereby/
|
|
100
|
-
"axios": "^1.2.3",
|
|
101
|
-
"btoa": "^1.2.1",
|
|
102
|
-
"events": "^3.3.0",
|
|
91
|
+
"@whereby.com/core": "*",
|
|
103
92
|
"heresy": "^1.0.4"
|
|
104
93
|
},
|
|
105
94
|
"peerDependencies": {
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/index.esm.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
}
|
|
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));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { fakeAudioStream, fakeWebcamFrame };
|