Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-video-recorder

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-video-recorder

Record Electron's window and export as video

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

electron-video-recorder

Capture Electron's window and export as video

Requirements

  • ffmpeg

    if you have FFmpeg installed, make sure to set the FFMPEG_PATH environment variable;

    Or, install @ffmpeg-installer/ffmpeg

  • electron

Install

npm i electron-video-recorder

Use

With Electron's Offscreen API, you can export videos in the background:

const fs = require("fs");
const { capture } = require("electron-video-recorder");
const { app, BrowserWindow } = require("electron");

const win = new BrowserWindow({
  webPreferences: { offscreen: true },
  show: false,
});

capture(win, { savePath: 'capture.mp4', fps: 25 }).then(handle => {
  handle.stop().then(() => {
    const buffer = fs.readFileSync('capture.mp4');
    win.close();
    win.destroy();
  });
})

Or with async func:

const fs = require("fs");
const { capture } = require("electron-video-recorder");
const { app, BrowserWindow } = require("electron");

const win = new BrowserWindow({
  webPreferences: { offscreen: true },
  show: false,
});

const handle = await capture(win, { savePath: 'capture.mp4', fps: 25 });
// Set up your custom stop event
await new Promise((r) => setTimeout(r, 10000));
const buffer = fs.readFileSync('capture.mp4');
win.close();
win.destroy();

API

capture(win, [options])
class:VideoCapture

Core class of capture, created when call capture(win), and return an instance;

VideoCapture.stop()

Manually stop capturing.

This method will automatically be called when BrowserWindow is closed or destroyed

const capture = await capture(win, { savePath: "capture.mp4" });
await new Promise(r => setTimeout(r, 5000));
await capture.stop();

Demo

There's an Electron example in project, Clone the project and run:

yarn dev

Reference

This library is referenced from playwright-video

Keywords

FAQs

Package last updated on 04 Nov 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc