You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
publicclassHtmlLauncherextendsGwtApplication {
// USE THIS CODE FOR A FIXED SIZE APPLICATION@OverridepublicGwtApplicationConfigurationgetConfig () {
GwtApplicationConfigurationcfg = newGwtApplicationConfiguration(1280, 720);
// UNCOMMENT THIS CODE FOR MUSIC WORKcfg.disableAudio = true;
// END OF CODE FOR MUSIC WORKreturncfg;
}
// END CODE FOR FIXED SIZE APPLICATIONpublicvoidrecreateAudio() {
Gdx.audio = newGwtAudio();
}
Call this method from core code with interface or something.
Please select the affected platforms
Android
iOS (robovm)
iOS (MOE)
HTML/GWT
Windows
Linux
MacOS
The text was updated successfully, but these errors were encountered:
Generally, playing music on game start is problematic on html5. Chrome and Firefox allow this if the user visited the webpage regularly, but you can't rely on it. That's why you should not play music on your start screen.
I gave it a try. On my Mac Safari, music never started on game start, but it worked when played a little later.
On my iOS 13.6 iPad, it did not play at all at first. I needed to set up debugging to investigate it, for this I needed to update the GWT plug in as well... and then the problem disappeared and music worked when played after a user interaction.
On my iOS 12 iPhone, music did play when tried some SECONDs after the game startet.
All in all, behaviour on Safari is weird and different on every device I used. I have no more ideas what to try.
Code trying to do this all automatically is here:
Issue details
com.badlogic.gdx.audio.Music
not play on:On mac this error in console:
Unhandled Promise Rejection: NotAllowedError
.But
com.badlogic.gdx.audio.Sound
works normally.Reproduction steps/code
Play any music on Mobile safari.
Version of LibGDX and/or relevant dependencies
implementation 'com.github.MrStahlfelge.gdx-backends:gdx-backend-gwt:1.910.0'
Solve
Recreate Gdx.audio after user clicked anywhere.
Call this method from core code with interface or something.
Please select the affected platforms
The text was updated successfully, but these errors were encountered: