0

I'm using Flash HTML5Canvas document to publish html files. I want to add audio playback and started using SoundJS but having problems in using it.

I used the following code in the file.

createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin, createjs.FlashPlugin]);

But when I publish it and and run it in browser(Chrome, Win7 Pro 64) I get the following error in console.

"Cannot read property registerPlugins of undefined"

When I checked the html source code, soundjs source is not mentioned. easeljs, tween & movieclip sources are mentioned.

How do I get this resolved?

Thanks :)

  • How are you including the soundjs.js? Looks like it's not included/loaded at all. – derz Jul 22 '15 at 09:36
  • @derz I manually added it in the .html file. When I run it, it gives me additional "XMLHttpRequest cannot load" along with the previous error! Thanks for your input. – apostleofzion Jul 22 '15 at 14:35
  • Try to load it locally instead of the cdn to test it. You can download the library here: https://github.com/CreateJS/SoundJS/tree/master/lib (soundjs-0.6.1.min.js) – derz Jul 22 '15 at 18:47
  • is the comment above a typo, or is it missing an "http://"? Do you get a 404 in your console? – Lanny Jul 22 '15 at 22:36
  • 1
    Additional to @Lannys comment you also you made a typo with the semicolon after the src="". Try changing it to: ``. Keep in mind that by setting // it will load the script via HTTP or HTTPs depending if the site is viewed in SSL trough HTTPS (url/uri feature :-)). – derz Jul 23 '15 at 07:32
  • @derz and Lanny thanks for the info. I found the way to make it work now. will post as a reply. :) – apostleofzion Jul 28 '15 at 12:39

1 Answers1

0

First I needed to edit the html file produced by flash cc. I manually added the line

"http://code.createjs.com/soundjs-0.6.1.min.js"></script>

Double clicking the edited html file and running in browser gives HTTP errors.

So in the publish settings of Flash CC, I disabled the 'Overwrite HTML' option and then if I test/publish via Flash CC, Soundjs loads fine. It requires a local server to test it and I missed that part.