Closed glvarnell closed 13 hours ago
可以将mp3打包在assets里面,并且播放功能正常。 建议你排查: 1️⃣浏览器的console看是否mp3的路径读取错误(你也可以在vscode/jb golang的控制台里面看到静态文件引用情况); 2️⃣检查你的js插件所预定义的mp3格式是否正确。
Hey, have you tried to add it in you frontend/package.json
file?
"build": "tsc && vite build && cp -r assets/* dist/assets/",
You should import the audio and use it like this.
import audioSrc from '#/assets/audio/yourSoundfile'
useAudio(audioSrc)
Not Like This
useAudio('#/assets/audio/yourSoundfile')
Closing this as it's a local issue 👍
Description
If I create a simple vanilla javascript wails app that just uses fireworks.js everything works including sound when I run wails dev. When I build the application it doesn't look like the mp3 files are included in the assets and I do not get any sound.
To Reproduce
Create a vanilla javascript wails app wails init -n fireworks -t vanilla -ide vscode
I have tried installing fireworks.js from npm as well as just using the CDN in index.html Download and place explosion0.mp3, explosion1.mp3 and explosion2.mp3 in the assets folder. Update the javascript config json to use the audio files. a small snippet from the config json: sound: { enabled: true, files: [ './src/assets/explosion0.mp3', './src/assets/explosion1.mp3', './src/assets/explosion2.mp3' ], volume: { min: 4, max:100 } }
run wails dev The audio plays
run wails build no audio and no mp3 files are placed in dist/assets
Expected behaviour
I expect the assets to be bundled and work from the binary build the same as in the dev build.
Screenshots
No response
Attempted Fixes
No response
System Details
Additional context
Other than this minor issue I am loving wails. Thank you for all the hard work on this wonderful project!