dart - Exception when trying to load .mp3 file in Phaser -
i trying load very short .mp3 file in preload()
function this:
game.load.audio('sword', '$assetpath/swordraw.mp3', true);
as code gets executed, crashes error
breaking on exception: invalid arguments(s)
pointing console.warn
in phaser's loader
's fileerror
function below:
fileerror(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'] + ' url ' + this._filelist[index]['url']); this.nextfile(index, false); }
through debugger of darteditor have seen reason _filelist[10]['url']
(url audio file) picked being null here, , cause of exception (can't concat. null
string) why url null?
i've checked obvious: file name correct , assetpath
initialised correctly since other files (which images) before load fine. seems audio file issue of kind can't see problem is.
oh, seems found offender here... https://github.com/playif/play_phaser/blob/ae6a08e5a6eb159149fac01e5831fd8572223a44/lib/loader/loader.dart#l1447
when loader
setting stuff newly added file calls getaudiourl
if file audio file...
getaudiourl(urls) { //string extension; if (urls string) { urls = [urls]; } (var = 0; < urls.length; i++) { var url = urls[i]; //extension = urls[i].tolowercase(); //extension = extension.substr((math.max(0, extension.lastindexof(".")) || infinity) + 1); if (this.game.device.canplayaudio(url.split('.').last)) { //return urls[i]; return url; } } return null;
}
...and may gather above, method return null
seemingly if device cannot play the type of file supplied. then, dartium can't play .mp3s?
Comments
Post a Comment