GameDev problem: the music in our WebGL game on itch.io won't start until the user clicks in the window. Unity claims this is a browser limitation (no autoplay):
https://docs.unity3d.com/Manual/webgl-audio.html
... but the user has *already* clicked to load and launch the game, so it seems there should be no reason to require another click. I know I've seen WebGL games on itch that don't have this problem.
Does anyone know a workaround?
#GameDev #GameJam #unity #unity3d #itch #audio #sound #music #WebGL
@peterdrake Put a quick interstitial scene at the start with a "START GAME" button?
@LouisIngenthron That should work, but we'd prefer to have music playing over the initial title menu. Otherwise the player has to click twice: once to go to the title menu and start the music, then again to start the game proper.
@LouisIngenthron Yeah, but it still feels like it requires an extra click.
@LouisIngenthron But it's not autoplaying. It doesn't do anything until you click on itch's load game button.
@peterdrake So then it sounds like the real problem is Itch's redundancy within web browsers.
@LouisIngenthron It's not just itch, because this happens in a local web build, too.
@LouisIngenthron ... and plenty of other games don't require such a pause. To grab one at random:
@peterdrake Maybe it has something to do with the permissions/iframe configuration in the HTML code? Looking at that example you posted, I see they explicitly set an allow=autoplay.
@peterdrake It does. Because if it didn't, I'd be mad at the browser for autoplaying.