0

I am trying to use preloadjs to load mp3 file. I also use HTMLAudioPlugin in Soundjs, but when I want to get the audiodom as use getResult function, it doesn't work in ios but not in chrome.

preloadManifest = [{src: "bgm.mp3", id: 'bgm', type:'createjs.AbstractLoader.SOUND'}]

createjs.Sound.registerPlugins([createjs.HTMLAudioPlugin]);

loader = new createjs.LoadQueue(true, null, true);

loader.addEventListener('complete',function () {
    loader.getResult('bgm') // undefined in ios
});
sCha
  • 1,454
  • 1
  • 12
  • 22
yvonne
  • 1
  • Any chance you are getting an error? Nothing looks wrong with your code at a glance. Try adding an error event to see if its not loading: `loader.addEventListener("error", function(e) { console.log(e); })` – Lanny Sep 07 '17 at 22:54
  • One note: you are passing in the wrong `type` on the sound. This won't break it, since it will fall back to extension-based detection, but its not correct. You have defined it as a string "createjs.AbstractLoader.SOUND". This is not a valid type. If you remove the quotes, then it is ok, or use "sound". – Lanny Sep 08 '17 at 02:33
  • Lastly, you are requesting a CORS resource (3rd param of LoadQueue), which may fail if the resource is on another server and there is no CORS header. Are you seeing errors in the console? – Lanny Sep 08 '17 at 02:36

0 Answers0