@whereby.com/browser-sdk 2.0.0 → 2.1.0-beta.2
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 +58 -38
- package/dist/cdn/{v2-embed.js → v2-embed-beta.js} +2 -2
- package/dist/cdn/v2-react-beta.js +3 -0
- package/dist/core/index.d.ts +2320 -0
- package/dist/core/index.js +63283 -0
- package/dist/embed/index.d.ts +63 -3
- package/dist/embed/index.esm.js +134 -134
- package/dist/react/index.d.ts +122 -95
- package/dist/react/index.esm.js +9609 -7862
- package/dist/utils/index.esm.js +65 -65
- package/package.json +20 -22
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,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/browser-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-beta.2",
|
|
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",
|
|
13
14
|
"exports": {
|
|
15
|
+
"./core": {
|
|
16
|
+
"import": "./dist/core/index.js",
|
|
17
|
+
"types": "./dist/core/index.d.ts"
|
|
18
|
+
},
|
|
14
19
|
"./react": {
|
|
15
20
|
"import": "./dist/react/index.esm.js",
|
|
16
21
|
"types": "./dist/react/index.d.ts"
|
|
@@ -26,6 +31,9 @@
|
|
|
26
31
|
},
|
|
27
32
|
"typesVersions": {
|
|
28
33
|
"*": {
|
|
34
|
+
"core": [
|
|
35
|
+
"dist/core/index.d.ts"
|
|
36
|
+
],
|
|
29
37
|
"react": [
|
|
30
38
|
"dist/react/index.d.ts"
|
|
31
39
|
],
|
|
@@ -46,13 +54,10 @@
|
|
|
46
54
|
"build": "rollup -c rollup.config.js",
|
|
47
55
|
"build:storybook": "storybook build",
|
|
48
56
|
"dev": "storybook dev -p 6006",
|
|
49
|
-
"install:e2e-sample-app": "cd test/sample-app && yarn custom_install",
|
|
50
|
-
"start:e2e-sample-app": "cd test/sample-app && yarn start",
|
|
51
57
|
"test": "yarn test:lint && yarn test:unit",
|
|
52
58
|
"test:lint": "eslint src/",
|
|
53
|
-
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
54
|
-
"test:unit:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
55
|
-
"test:e2e": "playwright test",
|
|
59
|
+
"test:unit": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
|
|
60
|
+
"test:unit:watch": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js --watch",
|
|
56
61
|
"storybook": "storybook dev -p 6006",
|
|
57
62
|
"build-storybook": "storybook build"
|
|
58
63
|
},
|
|
@@ -62,53 +67,43 @@
|
|
|
62
67
|
"@babel/preset-env": "^7.23.2",
|
|
63
68
|
"@babel/preset-react": "^7.22.15",
|
|
64
69
|
"@babel/preset-typescript": "^7.23.2",
|
|
65
|
-
"@playwright/test": "^1.38.1",
|
|
66
70
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
67
71
|
"@rollup/plugin-json": "^6.0.1",
|
|
68
72
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
69
73
|
"@rollup/plugin-replace": "^5.0.5",
|
|
70
74
|
"@storybook/addon-actions": "^7.5.2",
|
|
71
|
-
"@storybook/addon-essentials": "^7.
|
|
72
|
-
"@storybook/addon-links": "^7.
|
|
75
|
+
"@storybook/addon-essentials": "^7.6.13",
|
|
76
|
+
"@storybook/addon-links": "^7.6.13",
|
|
73
77
|
"@storybook/react": "^7.5.2",
|
|
74
78
|
"@storybook/react-webpack5": "^7.5.2",
|
|
75
79
|
"@testing-library/react": "^14.0.0",
|
|
76
80
|
"@types/btoa": "^1.2.3",
|
|
77
81
|
"@types/chrome": "^0.0.210",
|
|
78
|
-
"@types/
|
|
79
|
-
"@types/node": "^20.7.1",
|
|
82
|
+
"@types/node": "^20.11.16",
|
|
80
83
|
"@types/react": "^18.0.26",
|
|
81
84
|
"@types/uuid": "^9.0.7",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
83
|
-
"@typescript-eslint/parser": "^5.46.1",
|
|
84
85
|
"babel-loader": "^8.2.5",
|
|
85
86
|
"deep-object-diff": "^1.1.9",
|
|
86
87
|
"dotenv": "^16.3.1",
|
|
87
88
|
"dotenv-run-script": "^0.4.1",
|
|
88
|
-
"eslint": "^8.29.0",
|
|
89
|
-
"eslint-plugin-jest": "^26.5.3",
|
|
90
|
-
"jest": "29.4.3",
|
|
91
|
-
"jest-environment-jsdom": "29.4.3",
|
|
92
89
|
"lit-html": "^2.5.0",
|
|
93
|
-
"prettier": "^2.7.1",
|
|
94
90
|
"react": "^18.2.0",
|
|
95
91
|
"react-dom": "^18.2.0",
|
|
96
92
|
"rimraf": "^3.0.2",
|
|
97
93
|
"rollup": "^4.3.0",
|
|
98
94
|
"rollup-plugin-dts": "^6.1.0",
|
|
95
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
99
96
|
"rollup-plugin-terser": "^7.0.2",
|
|
100
97
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
101
98
|
"storybook": "^7.5.2",
|
|
102
|
-
"ts-jest": "29.0.5",
|
|
103
99
|
"tslib": "^2.4.1",
|
|
104
|
-
"typescript": "^4.9.4",
|
|
105
100
|
"uuid": "^9.0.1",
|
|
106
101
|
"yalc": "^1.0.0-pre.53"
|
|
107
102
|
},
|
|
108
103
|
"dependencies": {
|
|
109
104
|
"@reduxjs/toolkit": "^2.0.1",
|
|
110
105
|
"@swc/helpers": "^0.3.13",
|
|
111
|
-
"@whereby/jslib-media": "whereby/jslib-media.git#1.
|
|
106
|
+
"@whereby/jslib-media": "whereby/jslib-media.git#1.7.2",
|
|
112
107
|
"axios": "^1.2.3",
|
|
113
108
|
"btoa": "^1.2.1",
|
|
114
109
|
"events": "^3.3.0",
|
|
@@ -122,5 +117,8 @@
|
|
|
122
117
|
"string-width": "^4",
|
|
123
118
|
"jackspeak": "2.1.1",
|
|
124
119
|
"wrap-ansi": "7.0.0"
|
|
120
|
+
},
|
|
121
|
+
"publishConfig": {
|
|
122
|
+
"access": "public"
|
|
125
123
|
}
|
|
126
124
|
}
|