LinusU / node-loudness

🔊 A node.js library to control the systems output volume
MIT License
124 stars 39 forks source link

Loudness doesn't works with "electron ." #22

Open emilet16 opened 3 years ago

emilet16 commented 3 years ago

Loudness is a really nice lib. When I build it with "node .", it works well but if I build it using "electron ." (because I'm using it to make my app), it does nothing. How can I fix this?

daunJung-dev commented 2 years ago

It is same to me. I build app by electron-builder with asar: "true" option. so, I extracted .exe file from this library by using afterPackHook

exports.default = async function (context) {
  var fs = require("fs");
  var path = require("path");
  var origin = path.join(
    context.appOutDir,
    "resources/app.asar.unpacked/node_modules/mwl-loudness/impl/windows/adjust_get_current_system_volume_vista_plus.exe"
  );
  var destiny = path.join(
    context.appOutDir,
    "resources/app.asar.unpacked/adjust_get_current_system_volume_vista_plus.exe"
  );
  fs.promises.copyFile(origin, destiny, console.log);
};

package.json

"build": {
   ...,
    "asar": true,
    "afterPack": "./afterPackHook.js",
  },

but it can't find file when released. Is there any option to be replaced or fixed?

maiguoheng commented 2 years ago

I have the same problem when use in electron. To fix it ,i use myw-loudnessinstead and it works.

fyt2018 commented 6 months ago

I have the same problem when use in electron.