webchimera-renderer
v1.0.1
Published
renderer for WebChimera.js
Downloads
3
Maintainers
Readme
Renderer for WebChimera.js
Prerequisites
Install
npm install webchimera-renderer
Usage example
HTML:
<canvas id="canvas"/>
JS:
var renderer = require("webchimera-renderer");
var vlc = require("wcjs-prebuilt").createPlayer();
var options = { /* Add renderer options here */ }
renderer.bind(document.getElementById("canvas"), vlc, options);
vlc.play("http://archive.org/download/CartoonClassics/Krazy_Kat_-_Keeping_Up_With_Krazy.mp4");
JavaScript API
bind(canvas, vlc options)
: bind the Webchimera VLC player to a canvas element:canvas
can be a DOM node or selector (mandatory)vlc
is a VLC player created with WebChimera.js (mandatory)options
:fallbackRenderer
is a boolean mentioning if the fallback non-WebGL renderer should be used (optional, defaults to false),preserveDrawingBuffer
is a boolean mentioning if we should preserve the drawing buffer (optional, defaults to false),fileMode
is a boolean mentioning if we should fill canvas without re (optional, defaults to false),onFrameSetup
will be called when VLC'sonFrameSetup
callback is called, with the same arguments, after the canvas has been setup.onFrameReady
will be called when VLC'sonFrameReady
callback is called, with the same arguments, after the frame has been rendered to the canvas.onFrameCleanup
will be called when VLC'sonFrameCleanup
callback is called, with the same arguments, after the frame was cleaned up.
clear(canvas)
: draws a single black frame on a canvas element (it's recommended to clear the canvas when theMedia Changed
andEnded
events are triggered)getFps(function)
: returns int in callback, the number of frames that wore rendered in 1 seconds after the request was made (useful for performance tests and getting the current fps of a live stream as it normally returns as0
with the WebChimera.js native method, to note: even when playback is paused it still renders at 10 fps)