Can't get Sunvox JS player to work when locally hosted

Multi-platform modular music creation studio
Post Reply
justin
Posts: 20
Joined: Thu Jan 14, 2016 9:01 pm

Can't get Sunvox JS player to work when locally hosted

Post by justin » Mon Nov 11, 2019 1:48 pm

Hi,

I was hoping to use the Sunvox JS player for examples of my own -

https://warmplace.ru/soft/sunvox/jsplay/

and when I load this page in my browser everything works fine - I can see the `song loaded` message, for example.

So I started by trying to self- host this exact same html page, making the absolute minimum of changes - the only things I changed were the relative `/lib/sunvox*.js` URLS to absolute ones, pointing towards `https://warmplace.ru/soft/sunvox/jsplay/`.

When I serve the new, slightly modified page from my own server then everything *seems* to work fine - in particular all the assets required by the page seem to load, there are no 40X errors - but my page status is stuck at `initializing`.

Upon inspection of the javascript, it feels strongly to me like the `svlib.then` routine is not getting called (line 249) - that somehow `svlib` is not loading properly as is therefore not being initialised. But since there are no network errors and no console errors, I can't see what the problem might be.

Can anyone advise ? Am worried that the `warmplace.ru` server might be doing some kind of authorization that I'm not able to replicate on `localhost`.

Many thanks

---

for comparison, this is what I see in console when the standard page loads -

```
sunvox.js:4 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
(anonymous) @ sunvox.js:4
sunvox.js:4 falling back to ArrayBuffer instantiation
(anonymous) @ sunvox.js:4
(index):28 SunVoxLib loading is complete
sunvox.js:4 Desired audio buffer size: 2048 frames
(index):262 SunVox lib version: 1 9 4
(index):28 init ok
(index):28 loading: music/NightRadio - machine 0001.sunvox
(index):28 song loaded
```

my modified page, by way of contrast, shows nothing :-(

justin
Posts: 20
Joined: Thu Jan 14, 2016 9:01 pm

Re: Can't get Sunvox JS player to work when locally hosted

Post by justin » Mon Nov 11, 2019 4:40 pm

OK fixed - somehow I missed the fact that there's a `sunvox.wasm` file sitting in `/lib` that doesn't get downloaded if you save the webpage to Desktop. So now the only puzzle is how to change the mime type for it -

```
sunvox.js:4 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
(anonymous) @ sunvox.js:4
```

User avatar
NightRadio
Site Admin
Posts: 3392
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Can't get Sunvox JS player to work when locally hosted

Post by NightRadio » Wed Nov 13, 2019 9:02 am

So now the only puzzle is how to change the mime type for it
I saw the same error when opening JS player from the WarmPlace.
Just fixed it by adding the following string to .htaccess :
AddType application/wasm .wasm

Post Reply