I'm making a game with vanilla JavaScript and HTML5 Canvas. I have a "Touch to start" screen, and I need music playing right after the user clicks on it. The "click" listener works fine for mouse even if the click is dragged out of the screen, but I can't get it working fine for touch controls. If the user just taps, it works, but if the touch is dragged, the audio won't play.
I've also tried touchstart and touchend, but none works properly, they throw the following exception:
"Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first."
Also tried binding the event to both the window and the canvas, no difference.
It looks like the browser doesn't recognizes touch-move as an user interaction, but just tapping does...
I've seen HTML5 games built with Construct 3 where the music plays properly after a touch-move interaction, so there must be a way...
I've seen many posts about this, but can't find a working solution for this exact scenario.
Anybody knows a workaround? Thanks