Skip to main content
Participating Frequently
Jul 4, 2023 2:09 PM UTC
Question

Getting past AudioContext chrome blocker - user click

Hi
I can see this was discussed backed in 2019 but I have virtually zero js knowledge. I understand the issue that chrome (canvas) wants the user to click before it will play my audio file and I added a button to do this. Still I get the "It must be resumed (or created) after a user gesture on the page" message.

 

let root = this;
this.mybutt.addEventListener ("click", playSound);

function playSound () {
createjs.Sound.play("mymix");
}

 

 This is my attempt and it works locally.
 
I can see there are posting about resummed and suspend AudioContext but these dont go quite simple enough for my level, ie I cant find the whole piece of code or tutorial. Can anyone signpost me where I can find the whole solution to what must be a very common requirement?
 
Many thanks
Grouse
This topic is closed to new replies. Start a new post to keep the conversation going.

11 replies

kglad
Community Expert
Community Expert
Jul 4, 2023 2:17 PM UTC

what's the link to your html?

Translate
Grouse_GAuthor
Participating Frequently
Jul 4, 2023 2:35 PM UTC

Do you mean the url?  

https://delightfulgreetings.com/soundtest/soundTest.html

Thanks

Translate
kglad
Community Expert
Community Expert
Jul 4, 2023 2:43 PM UTC

you have an error in your code.  (ie, learn* to use the developer console of your browser.)

 

specifically, this.currentSoundStreamInMovieclip.instance is undefined

 

 

*

lesson 1 - https://youtu.be/PBDQN9CQSeI

lesson 2 - https://youtu.be/KJEl0OenGUY

Translate