Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with loading sound- Uncaught DOMException: Failed to read the 'responseText' ... #38

Open
se7enTale opened this issue Jun 5, 2017 · 6 comments

Comments

@se7enTale
Copy link

se7enTale commented Jun 5, 2017

Loading sound file with Hexi seems like did not work for me!

Trying to load a sound file in WAV format like this:

let thingsToLoad = ["sounds/music.wav"];

And caught up this error message in console:

"Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer'). at Resource._xhrOnLoad (file:///C:/Users/User/Desktop/Hexi%20-%20Copy/library/hexi.js:6041:65)"

Same with MP3/OGG format. Example 20_sounds does not work..caught with same error.. Is glad to know anyone can help me out with this..?

@jrfoxw
Copy link

jrfoxw commented Jun 5, 2017

Did you try using an MP3 instead of a WAV file?
I had a similar problem when using a .wav file, also make sure that the sounds directory is accessible and normally you access a directory using

let thingsToLoad = ["./sounds/music.wav"]

@jrfoxw
Copy link

jrfoxw commented Jun 6, 2017

Is the error happening when your loading your assets? Does it work properly without loading any sound files? Are you running this from a server or just directly from an index.html file?

@jrfoxw
Copy link

jrfoxw commented Jun 6, 2017

Try this code inside your script and check your console to see if it's showing the files trying to load :)

let log = console.log
let error = console.error

let music

//An array of files you want to load
let assets = [
               "./sounds/music.wav"
             ];

let canvasWidth = 900
let canvasHeight = 900

//Initialize and start Hexi
let g = hexi(canvasWidth, canvasHeight, setup, assets, load);
g.fps = 30;
g.scaleToWindow();
g.start();
g.backgroundColor = "black"

function load(){
    // load assets 
   log(`Loading ${g.loadingFile}`);
   log(`Progress ${g.loadingProgress}`);
   g.loadingBar();
}

function setup(){
   music = g.sound("./sounds/music.wav")
   music.play()

}

function play(){
  // moved music.play() to setup()
}

@se7enTale
Copy link
Author

se7enTale commented Jun 8, 2017

Caught the same error with zero progress.. works fine without sound..

@jrfoxw
Copy link

jrfoxw commented Jun 8, 2017

I'm assuming it does the same with any sound file, not just this one. So on that assumption, and looking at the error code it looks like that the file is not getting recognized as a string or array when it xhrOnLoad's. As long as you have full permissions on your system (admin, root) it should work.

If you want you can send me a link to the file your using and I can test it on my end.

@kittykatattack
Copy link
Owner

@jrfoxw Thanks so much for your help with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants