Skip to main content
Participating Frequently
July 4, 2023
Question

Getting past AudioContext chrome blocker - user click

  • July 4, 2023
  • 1 reply
  • 709 views
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 has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 4, 2023

what's the link to your html?

Grouse_GAuthor
Participating Frequently
July 4, 2023

Do you mean the url?  

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

Thanks

kglad
Community Expert
Community Expert
July 4, 2023

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