# Excerpts from WEB-build and Itch.io deploy of CGE Project journey

**URL:** https://forum.castle-engine.io/t/excerpts-from-web-build-and-itch-io-deploy-of-cge-project-journey/2125
**Category:** Uncategorized
**Created:** [February 24, 2026, 11:22pm UTC](https://forum.castle-engine.io/t/excerpts-from-web-build-and-itch-io-deploy-of-cge-project-journey/2125 "2026-02-24T23:22:37Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [April 30, 2026, 12:34am UTC](https://forum.castle-engine.io/t/excerpts-from-web-build-and-itch-io-deploy-of-cge-project-journey/2125/14 "2026-04-30T00:34:33Z")

</div>

Audio playback on the web is also close to being done:)

Right now on [branch webaudio (not master)](https://github.com/castle-engine/castle-engine/tree/webaudio).

Initial notes:

- Underneath we use [WebAudio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) but you don’t really need to know anything about it – just use [Castle Game Engine sound API and components](https://castle-engine.io/sound) and everything will work on the web.

- Note that the audio playback will be in a _suspended_ state when loading the page in modern web browsers. This is a feature, [the idea is that user should manually enable audio because it would be annoying if newly opened page could automatically play some sound](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Best_practices#autoplay_policy). So we can only start audio in response to _user interaction_ with a page, which in practice means: after a press (touch, mouse press, key press on focused canvas). Our engine handles the activation automatically, but you need to design your UX to encourage player to click on anything to start the playback. A button like “Start the game” will do the trick.

- Note the OggVorbis suppport depends on the browser (we rely that the browser can decompress OggVorbis on the web), but it’s commonly supported. See about supported media (including audio) formats: [Media types and formats for image, audio, and video content - Media | MDN](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats) , [Web audio codec guide - Media | MDN](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Audio_codecs) .

Tested on examples:

- platformer game
  - ~~(SOLVED) though note initial menu music doesn’t play~~

- audio/doppler\_demo
  - though note TODOs: Doppler effect is not done by WebAudio

Some TODOs before I merge this:

- ~~(DONE) Playing non-WAV formats (like OggVorbis) right when the buffer was loaded (e.g. playing iniital game music) will fail with `Cannot play sound "%s" because it is still decoding.` . We must handle this better, start playback once the OggVorbis finished decoding, instead of aborting.~~

- ~~(DONE) We use JS promises in naive way but that’s not good: We need to make sure that we cancel the promise (building a mechanism on top of JS to cancel any promise, maybe just ignoring result), as we must cancel a promise if the Pascal instance interested in the promise no longer exists (which may happen e.g. if you switch views before a promise was realized).~~

- ~~(DONE) platformer weird `shot.wav` playback must be investigated and fixed.~~

- ~~(WORKAROUNDED, issue not related to audio) game\_3d\_sound crashes (for reasons unrelated to audio, it seems?).~~

- ~~(DONE) play\_sounds crashes.~~

- (POSTPONED after merge in the end) Support other audio formats, like MP3. Also FMOD supports them. IOW, we are not limited to WAV / OggVorbis formats on some audio backends, and we should expose more audio formats, just with warning (that they are not cross-platform supported by CGE).

---

_[View the full topic](https://forum.castle-engine.io/t/excerpts-from-web-build-and-itch-io-deploy-of-cge-project-journey/2125)._
