项目作者: SMUsamaShah

项目描述 :
Record HTML5 canvas to webm video with JavaScript
高级语言: JavaScript
项目地址: git://github.com/SMUsamaShah/CanvasRecorder.git
创建时间: 2018-10-26T15:27:50Z
项目社区:https://github.com/SMUsamaShah/CanvasRecorder

开源协议:

下载


CanvasRecorder.js

HitCount

Record a canvas to webm video without effecting rendering performance.

NOTE: Only tested it with Chrome and should work fine with Firefox

Blog article: https://smusamashah.github.io/blog/2018/10/26/CanvasRecorder

How to use

Create a recorder

  1. const canvas = document.getElementById('animation');
  2. const recorder = new CanvasRecorder(canvas);
  1. // optional: bits per second for video quality, defaults to 2.5Mbps
  2. const recorder = new CanvasRecorder(canvas, 4500000);

Start recording

  1. recorder.start();

Stop recording

  1. recorder.stop();

Save/download recording

  1. recorder.save();
  2. // Save with given file name
  3. recorder.save('busy_motion.webm');

How it works

It is based on this WebRTC sample. Captures MediaStream from a canvas element and records it with MediaRecorder.