New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

video-canvas

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

video-canvas

Paint video on canvas. Extra light.

latest
Source
npmnpm
Version
4.0.3
Version published
Maintainers
1
Created
Source

video-canvas

Paint video on canvas. Extra light.

gzipped size Travis build status gzipped size

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() and video.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 = require('video-canvas');
import videoCanvas from 'video-canvas';

Usage

Simple usage:

const video = document.querySelector('video');
const canvas = videoCanvas(video); // returns the <canvas> element
document.body.appendChild(canvas)
video.play();
video.pause();

Provide your own canvas:

videoCanvas(video, {
	canvas: document.querySelector('.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 = videoCanvas(video, {
	updateSize: false
});

If you want to customize the draw call, pass your drawing function as drawCall

const canvas = videoCanvas(video, {
	drawCall: function (ctx, video) {
		ctx.drawImage(video, 0, 0, 100, 100)
	}
});

Dependencies

No dependencies.

  • get-media-size: get the real size of any media: images, videos, canvas and canvas' contexts
  • iphone-inline-video: You don't need canvas to play video inline on the iPhone

License

MIT © Federico Brigante

Keywords

browser

FAQs

Package last updated on 30 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts