gst.wasm
is a GStreamer port to WebAssembly. Its main goal is to implement the support of WebAssembly
in GStreamer (and its dependencies) and bring the changes upstream. This repository is a placeholder to
keep up-to-date information required on how to build, develop, and deploy GStreamer in a browser or in
a node.js
runtime environment until all the information is finally merged into the corresponding
projects.
We use the standard libraries and tools used on GStreamer. The gray boxes are the dependencies and the green ones are new projects that will become part of mainstream GStreamer.
block-beta
columns 3
gst["gst-plugins-web"]:1
space
js["js-gstreamer-bindings"]:1
browser["Browser/Node.js"]:3
Emscripten:3
GStreamer:3
GLib Orc Cerbero
libffi space meson
style browser fill:#90e2f7,stroke:#4a7580;
style gst fill:#cee741,stroke:#728024;
style js fill:#cee741,stroke:#728024;
style Emscripten fill:#90e2f7,stroke:#4a7580;
style GStreamer fill:#e6e6e6,stroke:#808080;
style GLib fill:#e6e6e6,stroke:#808080;
style Orc fill:#e6e6e6,stroke:#808080;
style Cerbero fill:#e6e6e6,stroke:#808080;
style libffi fill:#e6e6e6,stroke:#808080;
style meson fill:#e6e6e6,stroke:#808080;
GStreamer has plenty of dependencies, especially at the plugin level, but our goal is focused on the core ones, as shown in the gray boxes of the above diagram. All dependencies use the git-upstream-workflow meaning that all branches will be committed upstream and all features are cumulative.
We use the fork at Fluendo in the gst.wasm branch.
We forked the excellent work done by kleisauke which is also a fork of GNOME.
The current status is grouped in the next cumulative branches:
- ⏳
wasm-2.76.0-revert-gregex
(Branch link) - ⏳
wasm-2.76.0-no-g_error
(Branch link) - ⏳
wasm-2.76.0-function-pointer
(Branch link) - ⏳
wasm-2.76.0-wasm-vs-emscripten
(Branch link) - ⏳
wasm-2.76.0-canvas-in-thread
(Branch link) - ⏳
wasm-2.76.0-main-loop-support
(Branch link) - ⏳
wasm-2.76.0-garray-fixes
(Branch link)
We use the fork at Fluendo in the gst.wasm branch.
The current status is grouped in the next cumulative branches:
- 🔄
meson_fix_nls
: Use nls option to set ENABLE_NLS (PR link) - ⏳
wasm-main-function-pointer
: Fix null function or function signature mismatch runtime errors (Branch link) - ⏳
wasm-main-enable
: Enable support for wasm (Branch link) - ⏳
wasm-main-test
: Enable unit tests for wasm (Branch link) - ⏳
wasm-main-openal
: Add emscripten support OpenAL to play audio (Branch link) - ⏳
wasm-main-gl-support
: Add emscripten OpenGL backend (Branch link) - ⏳
wasm-main-videodec
(Branch link) - ⏳
wasm-main-webtransport
(Branch link) - ⏳
wasm-main-wip
: Commits in progress (Branch link)
We use the fork at Fluendo in the gst.wasm branch.
The current status is grouped in the next cumulative branches:
- 🟢
tests
: Bring back tests (PR link) - 🟢
tests2
: Update more tests. Second round (PR link) - 🔄
tests3
: Tests update final round (PR link) - ⏳
local_source
: New type of source that allows you to build a recipe without fetching or copying sources (PR link) - ⏳
packaging
: Enable installation using pip with a git-https repository (PR link) - ⏳
emscripten
: Add support for building for wasm target with emscripten toolchain (Branch link) - ⏳
emscripten-gl
: Add OpenGL support in gst-plugins-base through new Emscripten based WebGL backend (Branch link)
We keep on sync all the samples found at samples into a public website to test them easily from any browser.
To build an environment, you can use steps from CI:
poetry install
git config --global protocol.file.allow always
poetry run cerbero -c build/gst.wasm.cbc bootstrap
poetry run cerbero -c build/gst.wasm.cbc build gst.wasm
As a result, in the local directory build/gst.wasm_web_wasm32/dist/web_wasm32
you've got all the needed packages with corresponding *.pc
files, which could be used
to build your project based on the WASM version of GStreamer and its dependencies:
$ ls build/gst.wasm_web_wasm32/dist/web_wasm32
bin include lib share
cd gst.wasm
meson --cross-file=emscripten-crossfile.meson _builddir
emrun _builddir/subprojects/videotestsrc/videotestsrc-example.html
emrun _builddir/subprojects/audiotestsrc/index.html # Press the 'play' button to hear to a sound.
emrun _builddir/subprojects/openal/openal-example.html # Click to hear to a sound.
Refer to the Development guide
Refer to the Coding Style guide
- Blog post GstWASM: GStreamer for the web
- GstConf2023 presentation GstWASM: Gstreamer for the web
- Special thanks to Fluendo for promoting and funding this project
- To @kleisauke for doing the first libffi/GLib to WASM port