Problem with HTML5 build on NW.js

I’m testing the newest version of the FMOD HTML5 build (upstream wasm) in the NW.js environment.

It recognizes it as a Node environment, but doesn’t recognize __dirname and __filename because some features work slightly differently between Node and NW.js.

Even if I hardcoded the directory and filename, it couldn’t find the wasm file.

So, I modified a part of the code as shown in the picture to force FMOD to recognize it as a web environment.
(If you can’t see it well, you can see that false is added as the first condition in the ENVIRONMENT_IS_NODE=typeof… part.)

Then, this time, the sound is not played until the user interacts with it, although it may not be the behavior of the FMOD recognized as a web environment.
There is also a problem because there is also no way to override this and force play.

Still, in the version 2.01.13, I was initially looking for FMOD to test its workings, ignore it and play was the default, so I used it to solve the problems I was facing at the time.

However, since this will make it impossible to update the version and use the new features, I wonder if we can expect improvements in this area in the future.

+ Does anyone use FMOD in Electron, which is more general than NW.js?
If you have had such a recent experience, please let me know how you solved it these issues if that have same behavior written in this thread, it might help to gain some insight.

Thank you for sharing your findings in relation to the ENVIRONMENT_IS_NODE variable- we do not explicitly test FMOD on Node, I have added a task to investigate this in more detail.
In 2.02.07 we started handling the user interaction internally; would it be possible for you to try updating and see if that gets around the user interaction requirement?

Hello jeff.

I tried version 2.02.08, still needs a fix to force it to be a web environment, but now I’ve confirmed that it works fine in NW.js without requiring any user interaction!

Thanks for the quick update just for this.

1 Like

Hello, sorry for reopening this thread.

In the lower version of NW.js (tested on 0.29.4), I found that audio came out without user interaction, but in the newest version of NW.js (tested on 0.66.1), I found that there was no audio until user interaction.

Is there has a solution for this?

Are you getting any console errors before interacting with the screen? We are adding listeners to the click and touchend events internally to resume audio, all things I assume are supported by the latest version of NW.js. Can you try calling OutputAudioWorklet_resumeAudio() from your code manually and see if that helps at all?

Hello, Jeff!

I just confirmed this issue, no notifications popped up on the console.
And like you said, I tried OutputAudioWorklet_resumeAudio().
Then FMOD start working fine with the log : Resetting audio driver based on user input.
Is it ok to use this function?

Thank you for confirming- we should be calling this function for you, the fact that it isn’t being called inidcates a possible fault with our setting of event listeners in NW.js.
I will update the Dev team with this information for their investigations with Node/NW.js. In the meantime it should be fine to call this method yourself.

1 Like

I really didn’t know there was a problem on the NW.js side.

Thank you for checking it out, Jeff!

1 Like