Open stephen-ip opened 1 year ago
Hi @stephen-ip, could this be a duplicate of #27 ?
I saw that and followed their solution to add
{ test: /\.node$/, use: "node-loader" }
to the webpack config (I'm using typescript and react). When I try running the app, I then get the error:
App threw an error during load:
Error: \\?\electron\.webpack\main\native_modules\obs_studio_client.node is not a valid Win32 application.
I used electron forge to start my project and in the config I saw it already has this in the rules:
// Add support for native node modules { // We're specifying native_modules in the test because the asset relocator loader generates a // "fake" .node file which is really a cjs file. test: /native_modules[/\\].+\.node$/, use: "node-loader", },...
With this, I assume that it's not a duplicate
Very strange. Are you you're running it in the main thread and not the renderer process? According to your first post it looks like that which should be fine.
You could swap the electron version with an older one to check if it is caused by a change in the recent electron versions.
I have tried upgrading all the packages in your demo electron obs app, and it still works, so I guess it's not a electron version issue. I am running it in the main thread the same way the example does. I copied the obsRecorder.js
file into the same directory as my main.ts
file and import it there. I then copy over the same ipcMain handlers as in the example. A difference is that the updated version of electron wants you to use preload scripts to expose the API and I have did that, which is essentially the same as using remote. I use the electron API to invoke start recording and then main should run it. I am also using npm if that matters, but I'm pretty lost as to what's causing this issue.
I followed the example code provided, but my code is failing on the first step when I try to run
osn.NodeObs.IPC.host("example");
I have theobsRecorder.js
file imported into mymain.ts
file usingconst obsRecorder = require("./obsRecorder");
and I have set up ipcMain handlers to handle the actions just like in the example. I suspect it might be something with the updated version of electron or something in the example being out of date. Could someone please help me solve this?