Saturday, 15 February 2014

dart - Exception when trying to load .mp3 file in Phaser -


I am trying to load my preload () function like this:

  game.load.audio ('sword', '$ asset path / sword. Mp3, true);  

As soon as this code is executed, it crashes with error

  Break: Invalid logic  

similar to indicating console.warn in the loader of fileError function Below is the following:

  file error (int index) {this._fileList [index] ['loaded'] = true; This._fileList [index] ['error'] = true; This.onFileError.dispatch ([this._fileList [index] ['key'], this._fileList [index]]; Window.console.warn ("Phaser.Loader error loading file:" + + this._fileList [index] ['key'] 'from URL' + this._fileList [index] ['url']); This.nextFile (index, incorrect); }  

Through the DartEditor's debugger, I have noticed that for some reason _fileList [10] ['url'] (url for audio file) The tap is being taken here, and it is the reason for the exception (not the code. In the null string), but why is the URL empty?

I have checked clearly: the name of the file is correct and assetpath has definitely started properly because all other files before loading Images), so it looks like some kind of audio file problem, but I can not see what the problem is.

Oh, it seems that I've got the culprit ...

When loader is installing stuff about a new file, then this is getAudioUrl if the file is an audio file ...

  GetAudioURL (URL) {// string extension; If (URL is string) {urls = [urls]; } (Var i = 0; i & lt; urls.length; i ++) {var url = urls [i]; // extension = url [i] .toLowerCase (); // extension = extension.substr ((Math.max (0, Ext. LastIndexOf (".")) || Infinity) + 1); If (the.game.device.canPlayAudio (url.split ('.'). Last)) {// return URL [i]; Return url; }} Return tap;  

}

... and as you can gather from the top, the method empty will return, it appears that If the device can not play the type of file supplied then darity can not play MP3.


No comments:

Post a Comment