Closed octavn closed 6 years ago
What about Usage example? It's plain JS, just bind vmsg.record
call to any button and it should work.
For example I am trying to load the vmsg.wasm
using:
var importObject = {};
WebAssembly.instantiateStreaming(fetch('https://cdn.rawgit.com/Kagami/vmsg/df671f6b/vmsg.wasm'), importObject).then(
obj => obj.instance.exports.record()
);
and I get the following error in Chrome:
Uncaught (in promise) TypeError: WebAssembly Instantiation: Import #0 module="env" error: module is not an object or function
If I remove importObject
I get
Uncaught (in promise) TypeError: WebAssembly Instantiation: Imports argument must be present and must be an object
You shouldn't load vmsg.wasm
directly. Use the JS library instead.
It means you need to just host vmsg.wasm
, it should be available as /static/js/vmsg.wasm
URL by default. vmsg JS library will load that file for you.
I've managed to get a plain JS/HTML non React demo up and running. I will publish my code soon.
I've created a plain JS/HTML demo at https://github.com/addpipe/simple-vmsg-demo
Live demo: https://addpipe.com/simple-vmsg-demo/
Since I deal a lot with audio recording I've also covered vmsg in more detail in this article https://addpipe.com/blog/recording-mp3-audio-in-html5-using-vmsg-a-webassembly-library-based-on-lame/
Thanks.
Added it to readme.
All 3 demos are React based. Would love to see a non React demo or better documentation around using
vmsg
in a plain HTML/JS app.