Skip to content

Commit 20a3e10

Browse files
authored
Make SilenceFiller.ts more cross-platform (#530)
1 parent f723b34 commit 20a3e10

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/wrapper/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ export { MimeType, getBrowserSupportedMimeType } from "./getBrowserSupportedMime
1010
export { HumeClient } from "./HumeClient";
1111
export { EVIWebAudioPlayer, EVIWebAudioPlayerFFTOptions, EVIWebAudioPlayerOptions } from "./EVIWebAudioPlayer";
1212
export { collate } from "./collate";
13-
export { SilenceFiller } from "./SilenceFiller";
13+
14+
// SilenceFiller extends from Node.JS Readable -- this should not be exported in non-nodeJS environments. Otherwise the bundle will crash in the browser.
15+
export const createSilenceFiller = async () => {
16+
if (typeof process === "undefined" || !process.versions?.node) {
17+
throw new Error("SilenceFiller is only available in Node.js environments");
18+
}
19+
const { SilenceFiller } = await import("./SilenceFiller");
20+
return SilenceFiller;
21+
};

0 commit comments

Comments
 (0)