I have created an electron app consisting a sound effect. I am using the package sound-play
to play the sound effect in my main.js
file (learned from here). It is working as it should when I am running it through npm start
. But after packaging my app using electron-packager
, when I am running the exe file from "release-builds" folder, only the sound effect is not playing. All other aspects of the app are working fine.
Shutter.mp3 is the sound file which is present in the project directory
Main.js:
const sound = require("sound-play");
const filePath = path.join(__dirname, "shutter.mp3");
sound.play(filePath) //For playing the sound inside a function
Package.json:
"scripts": {
"start": "electron .",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
"package-win": "electron-packager . Namegoeshere --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Namegoeshere\"",
"package-linux": "electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds"
},
Using the command npm package-win
for packaging.
Just pointing it out again only sound is not playing after packaging. Other aspects are totally fine.
I am probably missing something very basic. Any help would be nice. Thanks.