Copy link to clipboard
Copied
I've tried a million things and can't get this sound to play either from the "test" menu item or from a local server.
I have previewed the sound in Animate and it plays, it's a 128kb MP3, and I've tried on Mac Safari, Chrome, and Firefox. Still, I get no sound.
I'm sure it's something simple... first time trying to do this... help is much appreciated!
My Code:
createjs.Sound.on("fileload", handleLoad);
createjs.Sound.registerSound("sounds/discoSong.mp3", "myID", 3);
function handleLoad(event) {
createjs.Sound.play("myID");
var myInstance = createjs.Sound.play("myID");
console.log(myInstance);
}
The output from that console.log:
a {_listeners: null, _captureListeners: null, src: "sounds/discoSong.mp3", uniqueId: 1, playState: "playSucceeded", …}
"playSucceeded"... I think not!
Thanks!
1 Correct answer
Problem solved, new computer, browser was blocking autoplay. Thanks for the help! How do I mark this discussion as closed?
Copy link to clipboard
Copied
For example:
- You need to add a linkage name for your sound file in the library.
- this.incorrect = createjs.Sound.play("incorrect", "none", 0, 0, 0, 0.6);
incorrect: this is the linkage name
- this.incorrect.paused = true; (it stops)
- this.incorrect.paused = false; (it plays)
Copy link to clipboard
Copied
Explanation
this.incorrect = createjs.Sound.play("incorrect", "none", 0, 0, 0, 0.6);
this.incorrect = createjs.Sound.play("linkagename", "interrupt", delay, offset, loop, volume);
Of course you may be importing the sound to the stage which is a different story.
Copy link to clipboard
Copied
this.discoSong = createjs.Sound.play("discoSong", "none", 0, 0, 0, 0.6 );
Linkage is set, I'm still getting nothing.
Copy link to clipboard
Copied
Does this happen with all your files?
Copy link to clipboard
Copied
I've only tried two, and both play in the browser. Are there further format restrictions in Animate? What format should I try?
Copy link to clipboard
Copied
Problem solved, new computer, browser was blocking autoplay. Thanks for the help! How do I mark this discussion as closed?
Copy link to clipboard
Copied
Awesome!!!
Copy link to clipboard
Copied
If you mark it as correct it will be closed somewhat. People can still see it and it is useful for searches.
Good luck on your project!
Copy link to clipboard
Copied
I am a new to html5. I'm using Adobe Animate to convert some FLA files to html5. Foe my first conversion, upon entering the page, background music should automatically play. The song that should be called is "Photos.mp3". The song is located in a subdirectory called "sounds" which exists in the same directory as my html file. The mp3 file does not play, I was going to attach my code, but I don't see a way to do that here.
Copy link to clipboard
Copied
I'm the original poster. I'm not sure how I ended up posting on a friend's account. I just wanted to add something: if I allow the page to keep looping, eventually at least part of the mp3 file will play. ?????
Copy link to clipboard
Copied
user interaction must occur before browsers will allow sound to play.
Copy link to clipboard
Copied
Drat. I was fearing that. Thank you.
Copy link to clipboard
Copied
you're welcome.
just put into design/text in frame 1 with a click here to proceed to you site. then advance to frame 2 and start your sound.
Copy link to clipboard
Copied
Accepted Answer: Replace your computer.

