Hi, I am having trouble getting a sequencer to run when embedded on a site in Chrome.
E.G. this sketch runs fine in the editor:
but when you try to embed or run it in presentation mode on chrome, the play button stops working:
it does work in edge and firefox though
Most examples I have found using Tone.js stop working when embedded, but this example: https://editor.p5js.org/lucwhite/sketches/HuPAIWpM1
also works in chrome embedded or in presentation mode. However I can’t figure out why.
I have a hunch this has something to do with the browser not allowing AudioContext to start without user interaction. The tone.js documentation suggests the following:
IMPORTANT : Browsers will not play any audio until a user clicks something (like a play button). Run your Tone.js code only after calling
Tone.start()from a event listener which is triggered by a user action such as “click” or “keydown”.
I don’t know enough about html and web development to understand what this means though. Is this something i need to do in the HTML file?
Any help figuring out how to make the first example run embedded on a webpage in chrome would be greatly appreciated.