HugoMcPhee Posted May 28, 2015 Share Posted May 28, 2015 Hi Everyone,In babylon.js, loading sounds through nw.js (v0.12.1 windows and linux) wouldn't work.using the same code from the babylonjs audio tutorial:// Load the sound and play it automatically once readyvar music = new BABYLON.Sound("Music", "music.wav", scene, null, { loop: true, autoplay: true });I replaced the filenames with the correct paths and got this error:(if the filename is incorrect it's this error instead: So it seems like the file was loading fine) So I looked at the line that was reporting the error (in babylon.2.1-beta.debug.js) , commented it out, and added the code that runs when there isn't an error, and the sound loaded and played!(using the latest babylon.js 2.1-beta, but the error also happened on babylon.js 2.0 stable)That's the temporary fix I found , I'm not sure what is causing the error, possibly something to do with loading local files?As a side note, The Wav file works, but when I tried an mp3 it gave this error:nw.js is based on chromium which should support mp3 files, so I'm not sure what happened,But for now wav files still work so this is just a quick fix if anyone is having problems with sound in nw.js Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted May 29, 2015 Share Posted May 29, 2015 I had a similar problem with Nw.js some days ago.In NW.js v0.12 .1 only plays wav, so no ogg and mp3 for some reason :-O(v0.13 ... alpha plays mp3 but it ha some bugs) You need to chage the ffmpegsumo.dll, you can found it here:http://s000.tinyupload.com/?file_id=01677383619096417495http://stackoverflow.com/questions/29590898/where-to-find-ffmpegsumo-libraries-for-nw-js-0-12-0-play-audio-files-in-nodewe Quote Link to comment Share on other sites More sharing options...
davrous Posted May 29, 2015 Share Posted May 29, 2015 Hi, Thanks for the feedback. Apparently, this is due to the fact that the file protocol always returns 0 for request.status. We haven't imagined being called that way. You then need to patch the code to check the protocol being used. If file://, we need to check that status === 0 and not 200. More details here:https://github.com/nwjs/nw.js/issues/1465 & http://stackoverflow.com/questions/18391481/xmlhttprequest-in-nodewebkit-status-0 Bye, David Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.