Update: HTML5 Audio fixes - and question for you

Hey,

I just deployed a significant update to the HTML5 audio system. The previous one was just kind of barely working in order to get the HTML5 engine released, but it should be much better now - it even has a couple of minor improvements:

  • Bugfix: Audio looping in editor fixed
  • Bugfix: Audio stopping issues fixed
  • Bugfix: Escape key now behaves properly when behavior window is open
  • Bugfix: Audio pauses/resumes with game
  • Improvement: Sound select preview uses volume setting
  • Improvement: Sound volume slider plays sound on change (to make testing volume easier)

** NOTE **
I also ran into an issue that I cannot easily resolve. Both Chrome and Firefox (and Safari, and maybe others…) do not allow sounds to play until the player interacts with the page. Interact means click somewhere on the page, basically. This is a problem, obviously, for any game that has audio on the intro screen. I’d like to hear thoughts about how we should handle this - here are some ideas:

  1. Don’t change anything - if you want to have audio play on the initial startup, have some sort of “unmute” or “play” button on the screen that initiates the music or ambient audio.
  2. Have some sort of “click to unmute” message on the loading screens. This isn’t ideal, since it would not be customizable per game - they would all look the same.
  3. Have some sort of messaging outside the game, on the page. This isn’t great either, since people would likely not ever read it.
  4. Maybe some other idea?

Some documentation on this issue:
https://hacks.mozilla.org/2019/02/firefox-66-to-block-automatically-playing-audible-video-and-audio/
https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio

@grazer Thanks for the bug fixes.

It makes a lot of sense now why the sound wasn’t working until I pressed play.

I think you should add a simple “click anywhere to start” screen after the game has loaded. Exported games don’t have this issue, and they don’t have loading screens on start up too. So just asking the player to click in the loading screen would be the best approach to me.

Small question, are you able to ask the user to allow autoplay? Just like the message to allow flash, notifications etc. If it’s not possible, you can show a message on the web page if autoplay is disabled. And you can give them a link with a tutorial on how to enable it so they don’t have to click every time if they want to play a game.

I agree with Latif. A simple “click to start” it’s good enough, as long as it doesn’t make it to the exported version.

@grazer I reported this a long time ago but it’s still an issue. On mobile (android to be specific), you can only use the over and out outputs in mouseclick for just one finger.

Here’s an explanation:
1) Hold your left thumb on button A
Result: Button A will now trigger “over”

2) Hold your right thumb on button B while still holding button A with your left thumb
Result: Button B will now trigger “over”, but button A will trigger “out” when I didn’t even release my left thumb. This shouldn’t happen.

It’s kinda pointless to make mobile games now because you can’t even make simple on-screen buttons.

EDIT: If you want a game to test it, I made one myself: http://flowlab.io/game/play/727091

wererer

A possibility.
Every time you click off-screen or switch tabs it pauses everything or doesn’t pause at all. Up to you.
Clean and professional.
(Source: some random game-sharing website)

@grazer This happens only on my Lenovo Computer. Screenshot (1)

My mouse will not go together with the selected grid, but this happens only in Html.

But it works on Flash:

Screenshot (2)

Oh I guess my mouse didn’t show up but basically if I put my mouse on one of the grid then it selects a grid farther away and one that does not have my mouse on it.

@grazer I have a small question: when will html5 replace flash and officially be in flowlab by default? I know we have access to it now, but when do you think the final version of html5 be released?