I'm quite new to emscripten, so please be patient with me :)

My goal is to create a wrapper class with an instance of a VideoDecoder 
object from WebCodecs API and pass some configurations inside it from C++.

 I'm trying to pass an object called 'init' on the global "VideoDecoder" 
object, which accepts a callback function on its members: output and error:

LVideoDecoderWebCodecs::LVideoDecoderWebCodecs()
{
    val VideoDecoder = val::global("VideoDecoder");

    if (!VideoDecoder.as<bool>()) {
        EM_ASM(
            console.error("WebCodecs API not available");
        );
    }

    val config = val::object();
    config.set("codec", val("vp8"));
    config.set("codedWidth", val(640));
    config.set("codedHeight", val(480));

    val init = val::object();
    init.set("output", [](val frame) {
        EM_ASM(
            console.log("Got frame: ", frame);
        );
    });

    init.set("error", [](val e) {
        EM_ASM(
            console.error("Error initializing decoder: ", e);
        );
    });

    val decoder = VideoDecoder.new_(init);
    decoder.call<void>("configure", config);
}

The module compiles successfully but when I run it on the browser it says,
wasmapi.js:4543 Uncaught BindingError: _emval_take_value has unknown type

It seems that I can't set a callback function on the init object.

Is there a solution to this? Or what can you suggest I handle this one.


-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/4d91b457-5161-41c7-973b-a211a946b62bn%40googlegroups.com.

Reply via email to