kaboom icon indicating copy to clipboard operation
kaboom copied to clipboard

Audio not playing on mobile

Open slmjkdbtl opened this issue 3 years ago • 2 comments

Version

v2000.1

What browsers are you seeing the problem on?

Chrome, Firefox, Safari, Microsoft Edge, Other

What happened?

Nothing plays

What's the expected behavior?

There should be some sounds

Minimum reproducable code

kaboom()
burp()

Live demo

https://kaboomjs.com/play?demo=burp

Is there an existing issue for this?

  • [X] I've searched and there is no existing issue for this bug

slmjkdbtl avatar Jan 06 '22 02:01 slmjkdbtl

Kaboom audio sounds definitely play on mobile (very well too!), check out this example: https://replit.com/@jwsy/avocado-remix - hosted at https://avocado-remix.jwsy.repl.co/

The way I get this to work is to play a howler sound first that ??? which causes all the other sounds to play. I imagine this has something to do with how mobile browsers require a click event to play and perhaps Kaboom isn't registering the touch events as click events.

L17 - creates the Howl obj L337 - plays the sound in the "main" start scene - but this doesn't work if replace this line with a kaboom play sound callconst o = play("o"...)

jwsy avatar Feb 16 '22 05:02 jwsy

Interesting, sounds like howler helped kaboom to properly initiate some audio context required to play audio on mobile. I'll take a closer look tomorrow.

slmjkdbtl avatar Feb 16 '22 07:02 slmjkdbtl