Skip to content

Commit

Permalink
fix: create separate worker threads
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 authored Nov 17, 2023
1 parent c3dc43a commit a3d2a0b
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 31 deletions.
4 changes: 2 additions & 2 deletions apps/100ms-custom-app/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions apps/100ms-web/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/hls-player/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/hls-stats/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/hms-noise-suppression/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/hms-video-store/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/hms-video-web/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions packages/hms-video-web/src/utils/timer-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export const worker = `(function metronomeWorkerSetup() {
};
})()`;

const WorkerThread = new Worker(URL.createObjectURL(new Blob([worker], { type: 'application/javascript' })));

/**
* Delay for a @see ms amount of time
* @param ms -- time in milliseconds
Expand All @@ -34,12 +32,16 @@ export function workerSleep(ms: number): Promise<void> {
if (ms < 0) {
throw Error('`ms` should be a positive integer');
}
// const buffer = new ArrayBuffer(8);
if (typeof Worker === 'undefined') {
return sleep(ms);
}
const WorkerThread = new Worker(URL.createObjectURL(new Blob([worker], { type: 'application/javascript' })));
WorkerThread.postMessage(['start', ms]);
return new Promise(resolve => {
WorkerThread.onmessage = event => {
if (event.data === 'tick') {
resolve();
WorkerThread.terminate();
}
};
});
Expand Down
6 changes: 3 additions & 3 deletions packages/hms-virtual-background/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/react-icons/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/react-sdk/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/roomkit-react/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/roomkit-web/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 comments on commit a3d2a0b

@vercel
Copy link

@vercel vercel bot commented on a3d2a0b Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on a3d2a0b Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

storybook-app – ./packages/roomkit-react

storybook-app-five.vercel.app
storybook-app-git-production-100mslive.vercel.app
storybook-app-100mslive.vercel.app
ui.100ms.live

Please sign in to comment.