Skip to content

Commit 25f013b

Browse files
authored
audio and browsers section for wasm examples (#8625)
# Objective - Help users better understand audio issues in wasm ## Solution - Describe some of the known issues, and some of the workarounds
1 parent ad88759 commit 25f013b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs-template/EXAMPLE_README.md.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ git checkout v0.4.0
5252
- [WASM](#wasm)
5353
- [Setup](#setup-2)
5454
- [Build & Run](#build--run-2)
55+
- [WebGL2 and WebGPU](#webgl2-and-webgpu)
56+
- [Audio in the browsers](#audio-in-the-browsers)
57+
- [Optimizing](#optimizing)
5558
- [Loading Assets](#loading-assets)
5659

5760
# The Bare Minimum
@@ -244,6 +247,12 @@ Bevy has an helper to build its examples:
244247

245248
This helper will log the command used to build the examples.
246249

250+
### Audio in the browsers
251+
252+
For the moment, everything is single threaded, this can lead to stuttering when playing audio in browsers. Not all browsers react the same way for all games, you will have to experiment for your game.
253+
254+
In browsers, audio is not authorized to start without being triggered by an user interaction. This is to avoid multiple tabs all starting to auto play some sounds. You can find more context and explanation for this on [Google Chrome blog](https://developer.chrome.com/blog/web-audio-autoplay/). This page also describes a JS workaround to resume audio as soon as the user interact with your game.
255+
247256
### Optimizing
248257

249258
On the web, it's useful to reduce the size of the files that are distributed.

examples/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ git checkout v0.4.0
7070
- [WASM](#wasm)
7171
- [Setup](#setup-2)
7272
- [Build & Run](#build--run-2)
73+
- [WebGL2 and WebGPU](#webgl2-and-webgpu)
74+
- [Audio in the browsers](#audio-in-the-browsers)
75+
- [Optimizing](#optimizing)
7376
- [Loading Assets](#loading-assets)
7477

7578
# The Bare Minimum
@@ -533,6 +536,12 @@ Bevy has an helper to build its examples:
533536

534537
This helper will log the command used to build the examples.
535538

539+
### Audio in the browsers
540+
541+
For the moment, everything is single threaded, this can lead to stuttering when playing audio in browsers. Not all browsers react the same way for all games, you will have to experiment for your game.
542+
543+
In browsers, audio is not authorized to start without being triggered by an user interaction. This is to avoid multiple tabs all starting to auto play some sounds. You can find more context and explanation for this on [Google Chrome blog](https://developer.chrome.com/blog/web-audio-autoplay/). This page also describes a JS workaround to resume audio as soon as the user interact with your game.
544+
536545
### Optimizing
537546

538547
On the web, it's useful to reduce the size of the files that are distributed.

0 commit comments

Comments
 (0)