Jump to content

(partially solved) Loading Sound Issues with Nw.js (node-webkit)


HugoMcPhee
 Share

Recommended Posts

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:

2dm81t3.jpg

(if the filename is incorrect it's this error instead: So it seems like the file was loading fine)

1ouck2.jpg

 

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!
11kl7h2.jpg

(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:
9idczq.jpg
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
 

Link to comment
Share on other sites

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=01677383619096417495
http://stackoverflow.com/questions/29590898/where-to-find-ffmpegsumo-libraries-for-nw-js-0-12-0-play-audio-files-in-nodewe
 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...