Audio
Legends of Learning has deprecated the audio interfaces we provided in the past.
Instead, developers should treat audio like any other concern, using vanilla JS or Javascript plugins as needed. We recommend (but do not require) Howler.js for Audio. Howler.js gives you greater control over sound, as well as reduce the level of complexity of working with cross-browser support of WebAudio. It can be loaded from a CDN or via a package manager like npm.
General Javascript Organization
We suggest script tags after visible content and CSS, to make user-visible aspects load first
We suggest using the
defer
andasync
attributes of the script tag to make game rendering happen as early as possible. For more information see https://flaviocopes.com/javascript-async-defer/
For Unity games, it is also acceptable to handle audio within Unity's audio system. Keep in mind that audio in WebGL is handled differently and is more limited than other Unity platforms. For more information see https://docs.unity3d.com/2019.1/Documentation/Manual/webgl-audio.html.
For Javascript and Construct2 games, your game still needs to listen for pause/resume state changes and adjust game sound accordingly.
Deprecated Methods
See Javascript API or Unity API for implementation details.
PlaySound
StopSound
ConfigureSound
Last updated