Skip to content

Commit f4fe326

Browse files
committed
chore(wip): enhance input handling by adding recursiveAwaitForInputs and updating getCameraStream to accept timeChunk parameter
1 parent 85e69cf commit f4fe326

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/inputs/getCameraStream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const opts = {
1515
verbose: true,
1616
} as const;
1717

18-
async function getCameraStream(): Promise<NodeJS.WritableStream> {
18+
async function getCameraStream(timeChunk: number): Promise<NodeJS.WritableStream> {
1919
var webcam = NodeWebcam.create(opts);
2020
await new Promise<void>((resolve, reject) => {
2121
const interval = setInterval(() => {
@@ -31,7 +31,7 @@ async function getCameraStream(): Promise<NodeJS.WritableStream> {
3131
setTimeout(() => {
3232
clearInterval(interval);
3333
resolve();
34-
}, 3000);
34+
}, timeChunk);
3535
});
3636
const bufferArray = webcam.shots.map((shot) => shot.data);
3737
const stream = new PassThrough();

src/inputs/getTextInput.ts

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { getCameraStream } from './getCameraStream';
2+
import { getMicrophoneStream } from './getMicrophoneStream';
3+
4+
async function recursiveAwaitForInputs() {
5+
const microphonePromise = getMicrophoneStream(3000);
6+
const cameraPromise = getCameraStream(3000);
7+
8+
const [microphoneStream, cameraStream] = await Promise.all([microphonePromise, cameraPromise]);
9+
}

src/server/createHttpServer.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)