video-canvas
Paint video on canvas. Extra light.
video-canvas
will take care of painting a video on canvas for you. In the easiest of setups, you provide a video and you get a correctly-sized self-updating canvas
ready to be used.
Features:
- It automatically starts and pauses painting with
video.play()
andvideo.pause()
. - If the video is paused or in a background tab, nothing is painted.
- It automatically creates a
canvas
element from your video (optional). - It automatically resizes the canvas to match your video (optional).
Install
npm install --save video-canvas
var videoCanvas = ;
;
Usage
Simple usage:
const video = document;const canvas = ; // returns the <canvas> elementdocumentbodyvideo;video;
Provide your own canvas:
;
By default, video-canvas
will automatically match the canvas size to the video size, whenever that changes. If you want to prevent this behavior, pass updateSize: false
const canvas = ;
If you want to customize the draw call, pass your drawing function as drawCall
const canvas = ;
Dependencies
No dependencies.
Related
get-media-size
: get the real size of any media: images, videos, canvas and canvas' contextsiphone-inline-video
: You don't need canvas to play video inline on the iPhone
License
MIT © Federico Brigante