horuspt Posted April 17, 2020 Share Posted April 17, 2020 Hi everyone! I'm getting a weird crash when trying to use html5 audio instead of webaudio. game.js?t=1587136739025:134123 Uncaught TypeError: Cannot assign to read only property 'dataset' of object '#<HTMLAudioElement>' at HTML5AudioFile.load (game.js?t=1587136739025:134123) at LoaderPlugin.<anonymous> (game.js?t=1587136739025:140350) at Set.each (game.js?t=1587136739025:92448) at LoaderPlugin.checkLoadQueue (game.js?t=1587136739025:140336) at LoaderPlugin.start (game.js?t=1587136739025:140286) at SceneManager.bootScene (game.js?t=1587136739025:68074) at SceneManager.start (game.js?t=1587136739025:68780) at SceneManager.bootQueue (game.js?t=1587136739025:67820) at EventEmitter.emit (game.js?t=1587136739025:4561) at Game.texturesReady (game.js?t=1587136739025:78674) From there, this is the line that's causing the issue within phaser var audio = new Audio(); audio.dataset = {}; //crash here! audio.dataset.name = this.key + ('0' + i).slice(-2); audio.dataset.used = 'false'; Looking at this (https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/dataset) it really looks like dataset is read only and should not be reassigned ever. I checked some of the examples (e.g. https://labs.phaser.io/edit.html?src=src/loader/audio/load%20html5%20audio.js&v=3.22.0) and it works fine there. As added info, I'm using typescript with the recommended template from phaser github (uses rollup). I'm also running it on different browsers and devices, with consistent behavior. Any help or hint is super appreciated! Thanks, David Link to comment Share on other sites More sharing options...
Recommended Posts