All Projects → dmnsgn → canvas-record

dmnsgn / canvas-record

Licence: MIT license
A one trick pony package to record and download a video from a canvas animation.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to canvas-record

Pyinstalive
Python script to download Instagram livestreams and replays.
Stars: ✭ 336 (+425%)
Mutual labels:  downloader, download, recorder, record
ee.Yrewind
Can rewind and save YouTube live stream
Stars: ✭ 133 (+107.81%)
Mutual labels:  downloader, download, record
Pyload
The free and open-source Download Manager written in pure Python
Stars: ✭ 2,393 (+3639.06%)
Mutual labels:  downloader, download
Downloader
Powerful and flexible Android file downloader
Stars: ✭ 193 (+201.56%)
Mutual labels:  downloader, download
react-use-downloader
Creates a download handler function and gives progress information
Stars: ✭ 65 (+1.56%)
Mutual labels:  downloader, download
nipper
🌶 💽 Nipper - Youtube playlist (& video) ripper
Stars: ✭ 23 (-64.06%)
Mutual labels:  downloader, recorder
Youget
YouGet - YouTube Video/Playlist Downloader/Cutter - MP3 Converter
Stars: ✭ 169 (+164.06%)
Mutual labels:  downloader, download
Telegram Upload
Upload and download files from Telegram up to 2GiB using your account
Stars: ✭ 223 (+248.44%)
Mutual labels:  downloader, download
4chan Downloader
Python3 script to continuously download all images/webms of multiple 4chan thread simultaneously - without installation
Stars: ✭ 136 (+112.5%)
Mutual labels:  downloader, download
gb-dl
A python based utility to download courses from infosec4tc.teachable.com , academy.ehacking.net and stackskills.com for personal offline use.
Stars: ✭ 33 (-48.44%)
Mutual labels:  downloader, download
VideoScreenRecorder
Record video of your screen and save the file locally 🎥
Stars: ✭ 36 (-43.75%)
Mutual labels:  capture, recorder
DownloadManagerPlus
Using faster and easier than Android Download Manager
Stars: ✭ 80 (+25%)
Mutual labels:  downloader, download
Macos Downloader
Command line tool for downloading macOS installers and beta updates
Stars: ✭ 162 (+153.13%)
Mutual labels:  downloader, download
Java Youtube Downloader
Simple, almost zero-dependency java parser for retrieving youtube video metadata
Stars: ✭ 160 (+150%)
Mutual labels:  downloader, download
Excel Parser Processor
Simply does the tedious, repetitive operations for all rows of excel files step by step and reports after the job is done. It can download files from URL(s) in a column of Excel files. If a new filename is provided at column B it will rename the file before saving. It will even create sub folders if column C is full with a valid folder name.
Stars: ✭ 177 (+176.56%)
Mutual labels:  downloader, download
Fgdownloader
用于断点下载、任务队列、上传进度、下载进度
Stars: ✭ 143 (+123.44%)
Mutual labels:  downloader, download
Saldl
A lightweight well-featured CLI downloader optimized for speed and early preview.
Stars: ✭ 203 (+217.19%)
Mutual labels:  downloader, download
CoubDownloader
A simple downloader for coub.com
Stars: ✭ 64 (+0%)
Mutual labels:  downloader, download
Aria2.sh
Aria2 一键安装管理脚本 增强版
Stars: ✭ 1,276 (+1893.75%)
Mutual labels:  downloader, download
Filedownloader
Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process
Stars: ✭ 10,408 (+16162.5%)
Mutual labels:  downloader, download

canvas-record

npm version stability-experimental npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

A one trick pony package to record and download a video from a canvas animation.

paypal coinbase twitter

Installation

npm install canvas-record

Usage

import canvasRecord from "canvas-record";
import canvasContext from "canvas-context";

const width = 100;
const height = 100;
const { context, canvas } = canvasContext("2d", {
  width,
  height,
});
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function record() {
  // Create recorder
  const canvasRecorder = canvasRecord(canvas);
  canvasRecorder.start();

  // Start canvas animation
  animate();

  // Let it run for 2 seconds
  await sleep(2000);

  // Stop and dispose
  canvasRecorder.stop();
  canvasRecorder.dispose();
}

record();

API

Modules

canvasRecord

Typedefs

CanvasRecordOptions : Object

Options for canvas creation. All optional.

canvasRecord

canvasRecord(canvas, [options]) ⇒ Object

Kind: Exported function
Returns: Object - The video MimeType is defined by recorderOptions.mimeType if present or is inferred from the filename extension (mkv) for "video/x-matroska;codecs=avc1" and default to "video/webm".
See: MediaRecorder#Properties

// Currently supported by Chrome
MediaRecorder.isTypeSupported("video/x-matroska;codecs=avc1");
MediaRecorder.isTypeSupported("video/webm");
MediaRecorder.isTypeSupported("video/webm;codecs=vp8");
MediaRecorder.isTypeSupported("video/webm;codecs=vp9");
MediaRecorder.isTypeSupported("video/webm;codecs=vp8.0");
MediaRecorder.isTypeSupported("video/webm;codecs=vp9.0");
MediaRecorder.isTypeSupported("video/webm;codecs=vp8,opus");
MediaRecorder.isTypeSupported("video/webm;codecs=vp8,pcm");
MediaRecorder.isTypeSupported("video/WEBM;codecs=VP8,OPUS");
MediaRecorder.isTypeSupported("video/webm;codecs=vp9,opus");
MediaRecorder.isTypeSupported("video/webm;codecs=vp8,vp9,opus");
Param Type Default Description
canvas HTMLCanvasElement The canvas element
[options] CanvasRecordOptions {}

canvasRecord~filename

Update the filename. Useful when recording several videovideos.

Kind: inner property of canvasRecord

canvasRecord~stream

A reference to the CanvasCaptureMediaStream

Kind: inner property of canvasRecord
See: MDN CanvasCaptureMediaStream

canvasRecord~recorder

A reference to the MediaRecorder.

Kind: inner property of canvasRecord
See: MDN MediaRecorder

canvasRecord~start([timeslice])

Start recording.

Kind: inner method of canvasRecord

Param Type Description
[timeslice] number The number of milliseconds to record into each Blob. If this parameter isn't included, the entire media duration is recorded into a single Blob unless the requestData() method is called to obtain the Blob and trigger the creation of a new Blob into which the media continues to be recorded.

canvasRecord~step()

Only needed when there is a need to exactly to capture a canvas state at an instant t.

Kind: inner method of canvasRecord
See: MDN CanvasCaptureMediaStreamTrack/requestFrame The CanvasCaptureMediaStreamTrack method requestFrame() requests that a frame be captured from the canvas and sent to the stream. Applications that need to carefully control the timing of rendering and frame capture can use requestFrame() to directly specify when it's time to capture a frame. To prevent automatic capture of frames, so that frames are only captured when requestFrame() is called, specify a value of 0 for the captureStream() method when creating the stream.

Notes: the technology is still a Working Draft not sure the output is guaranteed to have perfect frames.

canvasRecord~stop() ⇒ Array.<Blob> | Array

Stop the recorder which will consecutively call the recorder.onstop callback and download the video if not disable in the options.

Kind: inner method of canvasRecord
Returns: Array.<Blob> | Array - Returns the Blob chunk array (or chunks if timeslice is specified when starting the recorder).

canvasRecord~dispose()

Set recorder and stream to null for GC.

Kind: inner method of canvasRecord

CanvasRecordOptions : Object

Options for canvas creation. All optional.

Kind: global typedef
Properties

Name Type Default Description
[filename] string "Recording YYYY-MM-DD at HH.MM.SS.png" File name.
[frameRate] number 25 The frame rate used by the MediaRecorder.
[download] boolean true Automatically download the recording.
[recorderOptions] Object {audioBitsPerSecond: 128000, videoBitsPerSecond: 2500000 } The MediaRecorder options.

License

MIT. See license file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].