Skip to main content
Inspiring
October 7, 2018
Answered

Sound problem

  • October 7, 2018
  • 1 reply
  • 3116 views

I have made an animation of an image in html5 canvas in animate cc. Then I add an mp3 song in a frame with this code:

createjs.Sound.on("fileload", handleLoad); 

createjs.Sound.registerSound("xxx.mp3", "bgmLoop"); 

function handleLoad(event) { 

  createjs.Sound.play("bgmLoop");

}

In microsoft edge, the sound works but the image is still white no image view.

When I remove the code in .fla for canvas, the image of the animation in canvas appears.

How to use create.js for seamless background music?  This person has the same problem as me with the code.

For me, I don't work both in Chrome or Android.

What is the problem in the HTML 5 animate CC program.

Can anyone solve it so that it works with background music in my animation.

    This topic has been closed for replies.
    Correct answer kglad

    Yes this works in my Chrome browser. But I want to use sound then I come into the frame in begin without button or can I not to do it.


    you can‘t.  read the chrome info.

    1 reply

    kglad
    Community Expert
    Community Expert
    October 7, 2018

    there's nothing wrong with your code but open your console to see the problem.

    peorAuthor
    Inspiring
    October 8, 2018

    // create global alias to main timeline for event handler  

    // wait for sound to preload   

    // assign load event handler 

    createjs.Sound.on("fileload", handleLoad); 

    // load and register sound 

    createjs.Sound.registerSound("sacred.mp3", "soundID"); 

    // play sound and start timeline playing 

    function handleLoad(event) { 

    createjs.Sound.play("soundID");  

    I use this code in frame 1 in file musikprov.fla html5 canvas and in Microsoft Edge browser so works it but in Android os in smartphone and Chrome so don't works it.

    I have read this WebAudio Plugin and CreateJS broken in new Chrome Update and there it stands "the policy will be re-applied to the Web Audio API in Chrome 70 (October)". Is it the browser error both in Android and Iphone Apple IOS with code.createjs.com Sound.

    kglad
    Community Expert
    Community Expert
    October 8, 2018

    you need to use a click event or some other user interaction for chrome to trigger the play() method.