Highlighted

Mp3 and createjs

Explorer ,
Oct 15, 2019

Copy link to clipboard

Copied

I have this code in the HTML5 canvas fla document:
createjs.Sound.on("fileload", handleFileLoad);
createjs.Sound.registerSound("music1.mp3", "MySound");

function handleFileLoad()
{
createjs.Sound.play("MySound");
}
It doesn't launch in both Chrome or Android but in Microsoft Edge where it works.
In the Chrome console it says: "createjs-2015.11.26.min.js:17 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
c._generateCapabilities @ createjs-2015.11.26.min.js:17
2createjs-2015.11.26.min.js:17 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
b._createAndPlayAudioNode @ createjs-2015.11.26.min.js:17"

It has worked once with an HTML5 canvas fla document
Is the error in the createjs codes and why has it stopped working. So please help with solving this.

Views

374

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Mp3 and createjs

Explorer ,
Oct 15, 2019

Copy link to clipboard

Copied

I have this code in the HTML5 canvas fla document:
createjs.Sound.on("fileload", handleFileLoad);
createjs.Sound.registerSound("music1.mp3", "MySound");

function handleFileLoad()
{
createjs.Sound.play("MySound");
}
It doesn't launch in both Chrome or Android but in Microsoft Edge where it works.
In the Chrome console it says: "createjs-2015.11.26.min.js:17 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
c._generateCapabilities @ createjs-2015.11.26.min.js:17
2createjs-2015.11.26.min.js:17 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
b._createAndPlayAudioNode @ createjs-2015.11.26.min.js:17"

It has worked once with an HTML5 canvas fla document
Is the error in the createjs codes and why has it stopped working. So please help with solving this.

Views

375

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 15, 2019 0
Adobe Community Professional ,
Oct 15, 2019

Copy link to clipboard

Copied

It's already telling you in plain English exactly what the problem is. Why are you refusing to believe it? Modern browsers don't autoplay audio unless the user has interacted with the page.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 15, 2019 0
Explorer ,
Oct 16, 2019

Copy link to clipboard

Copied

Why does it work in Microsoft browser Edge than Google Chrome and Android. Is it wrong in createjs. It worked when I did a slideshow but it be a few times before but not now anymore. What happened. I want to be able to play an mp3 song without having a button that starts it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2019 0
Explorer ,
Oct 16, 2019

Copy link to clipboard

Copied

Have tested and tried so now it works. So now I have solved the problem. It now works in the Chrome browser.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2019 0
Adobe Community Professional ,
Oct 17, 2019

Copy link to clipboard

Copied

If it's working it's because you clicked somewhere on the page before your code tried to play the sound, OR if you're testing on a web server, you've trained your Chrome install to play the audio by raising the page's engagement index. If the latter, then it will still have problems for other users.

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

 

As for Edge, it works in Edge because Edge is not a modern browser. Microsoft has abandoned the current version of Edge and is working on a completely new version based on Chromium.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 17, 2019 0
Explorer ,
Oct 18, 2019

Copy link to clipboard

Copied

What should I do to make it work in Android and Chrome when using Animate CC with HTML5 canvas. Can you show me what code sets and how to go about it. Does it matter if I use mp3 or ogg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 18, 2019 0
Adobe Community Professional ,
Oct 18, 2019

Copy link to clipboard

Copied

You aren't listening. Let me try one more time.

 

Modern browsers don't autoplay audio unless the user has interacted with the page (or the page is YouTube or the user has already interacted with the page some number of times in the past).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 18, 2019 1
peor LATEST
Explorer ,
Oct 19, 2019

Copy link to clipboard

Copied

This is how it is. I have done a slide show with 52 pictures of me where I have lots of frames in Animate CC 2019 where in the library I have png, graphics and MovieClip. Then I'll convert a symbol graphic of png or to MovieClip or to button. Then give an instance name to MovieClip or button that I have done and I have also added some labels to some frames. In the label "begin" of the frame before frame I have

this.stop();
this.starta.addEventListener("click", playClicked.bind(this));

function playClicked() {
createjs.Sound.play("soundID");
this.play("begin");
}

// load and register sound   
createjs.Sound.registerSound("music1.mp3", "soundID");

This doesn't work but when I change or remove png and use a circle or square rectangle shape it convert a symbol to MovieClip then it start to play and even the sound of mp3 works in browser Chrome. I haven't tested in Android yet but I thinks it's works there also.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 19, 2019 0