This package has been deprecated

Author message:

WARNING: This project has been renamed to etro-node. Install using etro-node instead.

vidar-node

0.1.0 • Public • Published

Vidar for Node

Sometimes it's useful to use Vidar in Node. This package is a wrapper of Vidar that serves that purpose.

Usage

vidarNode(() => {
  // You can access inputs as html elements and pass them to Vidar as usual.
  const image = document.getElementById('input1') // <img> element
  ...
  movie.exportRaw()
    .then(window.done)
// Tell Vidar Node what inputs to load with { id: path }
}, { input1: 'path/to/image.png' }, 'output.mp4')

Documentation

vidarNode(vidarFunction, inputSources, resultCallbackOrPath[, page])

  • vidarFunction (string) - Function to run in the puppeteer page. vd and done are exposed as globals (accessed as properties of window)
    • window.done(exportedBytes) - Process the exported movie (resolved value of Movie#exportRaw), by either writing to resultCallbackOrPath if it's a string or executing it if it's a function
  • inputSources (Object<string, <string|Object>>) - the input assets, mapped from id to path or raw data. If the input is provided as raw data, it should be an object with the following properties:
    • type (string) - the MIME type of the input source
    • data (Buffer)
  • resultCallbackOrPath (function|string) - Determines what to do when window.done is alled in vidarFunction. If it's a string, it is treated as a path and the movie is written to it. If it's a function, it is called with one argument exportedBytes.
  • page (Page) - the puppeteer Page to use. Defaults to a page created by a new browser.

Runs vidarFunction in a puppeteer page. Each input source is converted to an html element (<img>, <audio> or <video>). The output is either written to the path or the callback is executed, depending on the type of resultCallbackOrPath.

Changelog

0.1.0 - 2020-09-30

Added:

  • vidarNode - the vidar wrapper
  • Movie#recordRaw - a convenience method for recording in the vidar wrapper

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GPLv3

Versions

Current Tags

VersionDownloads (Last 7 Days)Published

Version History

VersionDownloads (Last 7 Days)Published

Package Sidebar

Install

npm i vidar-node

Weekly Downloads

0

Version

0.1.0

License

GPL-3.0

Unpacked Size

8.29 kB

Total Files

4

Last publish

Collaborators

  • clabe45