Skip to content

HTML5 platform support #7

Open
Open
@caspark

Description

@caspark

Do you have any interest in supporting FMOD's HTML5 platform in this crate?

Doing so is tricky due to the ABI incompatibility between Emscripten and the wasm32-unknown-unknown target that much of the Rust community is targeting, but it's possible to make it work by proxying through JS: basically each fmod-oxide function would use wasm-bindgen to define some extern JS functions, which in turn call into a separate FMOD's WASM instance. The error handling is a pain but it does work (demo at bottom here).

So, theoretically:

  • I think it would be possible to provide approximately the same API this crate does today, and just "magically" have it work on the web.
  • The big exception is the initial initialization: it requires loading the FMOD JS script and calling window.FMODModule(myEmptyFmodObject), which then gives you a callback to "mount" files for loading banks and a second callback when FMOD is done loading - and only then can you create systems.
    • There are some other much smaller API differences too (for example you can't set a custom logging callback) but those could be handled via cfg attrs as needed.

Obviously it would be a significant amount of work to mirror all the APIs too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions