0.0.0-beta.14 • Published 4 years ago

@youngerheart/electron-recorder v0.0.0-beta.14

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

electron-screen-recorder

NPM version Downloads

usage

// install
npm i @youngerheart/electron-recorder -S

import { getWindow, startRecord, endRecord } from '@youngerheart/electron-recorder'

/**
 * initialize the MediaStream object with
 * an application window's video track
 * a audio track from merged desktop audio track and mic audio track
 * @params {Object} electron: the module object of electron
 * @params {String} name: the name of the window, capture main desktop while param undefined
 * @return {Object} promise: the promise object for result
 * @thenParams {Boolean} mic: existing mic audio track
 * @thenParams {Boolean} desktop: existing desktop audio track
 * @catchParams {Object} error: catched Error object
 */
let promise = getWindow(electron, 'yourWindowName').then(({ mic, desktop }) => {
  if (!mic) console.log('mic audio track was blocked, please check your devices')
  if (!desktop) console.log('desktop audio track was blocked, please check your devices')
}).catch(error => console.log(error))

/**
 * need to be call after getWindow finished
 * start record the media (webm formatted)
 * @params {Object} callback: return the blob file's object url
 * @params {Number} timeout: handle the file url per millisecond(default is 10000ms)
 */
startRecord((url) => {
  ipcRenderer.send('download', url)
}, timeout);

/**
 * need to be call after record started
 */
endRecord()

// main process
ipcMain.on('download', (target, url) => {
  targetWin.webContents.downloadURL(url) // start download...
})

develop

git clone
npm i
npm run dev

and require the js file at http://localhost:8080/index.js

0.0.0-beta.14

4 years ago

0.0.0-beta.13

4 years ago

0.0.0-beta.11

4 years ago

0.0.0-beta.12

4 years ago

0.0.0-beta.10

4 years ago

0.0.0-beta.9

4 years ago

0.0.0-beta.7

4 years ago

0.0.0-beta.8

4 years ago

0.0.0-beta.6

4 years ago

0.0.0-beta.5

4 years ago

0.0.0-beta.4

4 years ago

0.0.0-beta.3

4 years ago

0.0.0-beta.2

4 years ago

0.0.0-beta.1

4 years ago

0.0.0-beta.0

4 years ago

0.0.0-alpha

4 years ago