Skip to content

Commit eaecf26

Browse files
committed
fix: temporary fix to make things work
1 parent 426d816 commit eaecf26

File tree

6 files changed

+18
-33
lines changed

6 files changed

+18
-33
lines changed

.eslintrc.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = {
3333
},
3434
rules: {
3535
"no-alert": 0,
36-
"no-console": ["error", { allow: ["error", "info"] }],
36+
"no-console": ["error", { allow: ["error", "info", "debug"] }],
3737
"react/prop-types": 0,
3838
"react/sort-prop-types": 0,
3939
"import/order": 0,
@@ -78,10 +78,5 @@ module.exports = {
7878
},
7979
},
8080
],
81-
ignorePatterns: [
82-
"stories/**/*",
83-
"node_modules/**/*",
84-
"build/**/*",
85-
"canvasjs.min.jsx",
86-
],
81+
ignorePatterns: ["stories/**/*", "node_modules/**/*", "build/**/*", "canvasjs.min.jsx"],
8782
};

packages/frontend/components/vlogVideo.jsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as tf from "@tensorflow/tfjs";
33
import * as bodyPix from "@tensorflow-models/body-pix";
44
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
55
import { classNames } from "../utils/classNames";
6-
import { userMediaConstraints } from "../utils/constants";
76
import { loadBodyPix, readAsObjectURL, rgb2hsl } from "../utils/helpers";
87
let backgroundBlurAmount = 6;
98
let edgeBlurAmount = 0;
@@ -69,7 +68,7 @@ function VlogVideo({ isRecording, config }, ref) {
6968
let frame = ctx.getImageData(0, 0, canvasRef.current.width, canvasRef.current.height);
7069
let data = frame.data;
7170
let len = data.length;
72-
for (let i = 0, j = 0; j < len; i++, j += 4) {
71+
for (let j = 0; j < len; j += 4) {
7372
let hsl = rgb2hsl(data[j], data[j + 1], data[j + 2]);
7473
let h = hsl[0],
7574
s = hsl[1],
@@ -164,24 +163,11 @@ function VlogVideo({ isRecording, config }, ref) {
164163
(async () => {
165164
try {
166165
displayStream.current = await navigator.mediaDevices.getDisplayMedia({
167-
video: {
168-
width: globalThis.screen.width,
169-
height: globalThis.screen.height,
170-
displaySurface: {
171-
exact: "monitor",
172-
},
173-
},
166+
video: {},
174167
});
175168
let finalMediaConstraints = {
176-
...userMediaConstraints,
177-
audio: {
178-
...userMediaConstraints.audio,
179-
deviceId: { exact: config.audioDevice },
180-
},
181-
video: {
182-
...userMediaConstraints.video,
183-
deviceId: { exact: config.videoDevice },
184-
},
169+
audio: {},
170+
video: {},
185171
};
186172
if (isWithoutVideo) {
187173
delete finalMediaConstraints.video;

packages/frontend/hooks/useGetDevices.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { useEffect, useState } from "react";
2+
import { debug } from "../utils/helpers";
23

34
export default function useGetDevices() {
45
let defaultDevices = {
56
audio: [],
67
video: [],
78
};
89
const [devices, setDevices] = useState(defaultDevices);
10+
debug(devices);
911
useEffect(() => {
1012
(async () => {
1113
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
@@ -14,7 +16,7 @@ export default function useGetDevices() {
1416
try {
1517
const cameraPermission = await navigator.permissions.query({ name: "camera" });
1618
const micPermission = await navigator.permissions.query({ name: "microphone" });
17-
//toggleLoader()
19+
debug({ cameraPermission, micPermission });
1820
if (cameraPermission.state !== "granted" || micPermission.state !== "granted") {
1921
const stream = await navigator.mediaDevices.getUserMedia({
2022
video: true,

packages/frontend/pages/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default function Vlog() {
136136
<form className="w-full mx-auto md:w-1/4" onSubmit={handleFormSubmit}>
137137
{!initialState && (
138138
<>
139-
{devices.audio.length ? (
139+
{/* {devices.audio.length ? (
140140
<div className="flex flex-col mb-2">
141141
<label className="w-full font-semibold" htmlFor="audioDevice">
142142
Select audio input
@@ -205,7 +205,7 @@ export default function Vlog() {
205205
<label htmlFor="withoutVideo" className="font-semibold">
206206
Without Video
207207
</label>
208-
</div>
208+
</div> */}
209209
<button
210210
type="submit"
211211
className="flex-grow-0 w-full px-4 py-2 mt-5 font-bold text-white transition bg-green-500 rounded hover:bg-green-700"

packages/frontend/utils/constants.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ export const text = {
55
};
66

77
export const userMediaConstraints = {
8-
audio: {
9-
echoCancellation: true,
10-
noiseSuppression: true,
11-
sampleRate: 44100,
12-
},
8+
audio: {},
139
video: {},
1410
};
1511

packages/frontend/utils/helpers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ export function rgb2hsl(r, g, b) {
9191

9292
return [h, s * 100, l * 100];
9393
}
94+
95+
export function debug(...msg) {
96+
if (process.env.NEXT_PUBLIC_DEBUG) {
97+
console.debug(msg);
98+
}
99+
}

0 commit comments

Comments
 (0)