Note that there are some explanatory texts on larger screens.

plurals
  1. POStreaming video from a plugin to the browser
    text
    copied!<p>I've been writing a browser plugin that receives a stream of QVGA video. I'd like to stream that video to the browser in a way that can be programmatically interfaced from JavaScript - for example, something that can be fed into a canvas, like an element or Image() object.</p> <p>NOTE: this means I'm trying to avoid having my plugin draw into a window - I know I can do that, but I want something that interacts nicely with the rest of the page's rendering and also has a well-known object model that I won't have to implement.</p> <p>The tricky part is how to do it fast - I can do it for example by setting up the src property to have base64 encoded data, but the overhead is pretty high.</p> <p>My question is whether there's a way to avoid more overhead (e.g. feeding a raw image buffer instead of formatting an image and base64-encoding it only to have the browser decode it) - what I have right now isn't nearly fast enough.</p> <p>As for environment, I'm using Firebreath to write the plugin (C++ with NPAPI/ActiveX mostly abstracted away) and I want to preserve the Mac and Windows support I have. Delving into using NPAPI directly is acceptable but I'd rather not.</p> <p><strong>EDIT:</strong> I solved the problem by using an element and updating its 'src' property to a base64 encoded bitmap using the data UI scheme - (e.g. imageJSObject-&gt;SetProperty('src', 'data:image/bmp;base64,&lt;encoded BMP&gt;'); Performance isn't great, but it's good enough. The main caveat is that at least on Chrome 15, onload is fired only once, not every time I change the src property, so I have to generate my own event after each update.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload