{"_id":"@axelboberg/puppeteer-screen-recorder","name":"@axelboberg/puppeteer-screen-recorder","dist-tags":{"latest":"2.1.0"},"versions":{"2.1.0":{"name":"@axelboberg/puppeteer-screen-recorder","version":"2.1.0","description":"A puppeteer Plugin that uses the native chrome devtool protocol for capturing video frame by frame. Also supports an option to follow pages that are opened by the current page object","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"git+https://github.com/axelboberg/puppeteer-screen-recorder.git"},"author":{"name":"Prasana Kannan","url":"https://www.linkedin.com/in/prasanakannan/"},"contributors":[{"name":"Axel Boberg","url":"hello@axelboberg.se"}],"homepage":"https://prasanaworld.github.io/puppeteer-screen-recorder/","license":"MIT","keywords":["puppeteer","screen","screen recorder","video capture","video recorder","test case capture","video","record","cast","shot","video","record","puppeteer","pptr","pptr.dev","automatic","automation","screen cast","devtool","devtool protocol","screen frame","screeencast","screeencasts","screeenCasts","screeenCast","headless","headfull","FFMPEG"],"scripts":{"example":"ts-node src/example/index.ts","example:debug":"npm run example -- --inspect","build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"src/**/*.ts\" --write","fix:lint":"eslint src --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint src --ext .ts","test:prettier":"prettier \"src/**/*.ts\" --list-different","test:unit":"nyc --silent ava","check-cli":"run-s test diff-integration-tests check-integration-tests","check-integration-tests":"run-s check-integration-test:*","diff-integration-tests":"mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'","watch:build":"tsc -p tsconfig.json -w","watch:test":"nyc --silent ava --watch","cov":"run-s build test:unit cov:html cov:lcov && open-cli coverage/index.html","cov:html":"nyc report --reporter=html","cov:lcov":"nyc report --reporter=lcov","cov:send":"run-s cov:lcov && codecov","cov:check":"nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100","doc":"run-s doc:html && open-cli build/docs/index.html","doc:html":"typedoc src/ --exclude **/*.spec.ts --excludePrivate --target ES6 --mode file --out build/docs","doc:json":"typedoc src/ --exclude **/*.spec.ts --excludePrivate --target ES6 --mode file --json build/docs/typedoc.json","doc:publish":"gh-pages -m \"[ci skip] Updates\" -d build/docs","version":"standard-version","reset-hard":"git clean -dfx && npm i","prepare-release":"run-s test doc:html version doc:publish","ci":"run-s reset-hard doc:html version doc:publish"},"engines":{"node":">=10"},"dependencies":{"fluent-ffmpeg":"^2.1.2","@ffmpeg-installer/ffmpeg":"^1.1.0"},"optionalDependencies":{"@ffmpeg-installer/ffmpeg":"^1.1.0"},"peerDependencies":{"puppeteer":">=5.5.0"},"devDependencies":{"puppeteer":"^6.0.0","@ava/typescript":"^1.1.1","@istanbuljs/nyc-config-typescript":"^1.0.1","@types/node":"^14.14.13","@typescript-eslint/eslint-plugin":"^4.0.1","@typescript-eslint/parser":"^4.0.1","ava":"^3.12.1","codecov":"^3.5.0","cspell":"^4.1.0","cz-conventional-changelog":"^3.3.0","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-functional":"^3.0.2","eslint-plugin-import":"^2.22.0","gh-pages":"^3.1.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","open-cli":"^6.0.1","prettier":"^2.1.1","standard-version":"^9.0.0","ts-node":"^9.0.0","typedoc":"^0.19.0","typescript":"^4.0.2"},"ava":{"failFast":true,"timeout":"60s","typescript":{"rewritePaths":{"src/":"build/main/"}},"files":["!build/module/**"]},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"prettier":{"singleQuote":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","exclude":["**/*.spec.js"]},"gitHead":"e4f742d8cb34bb68c3384a901300e3274800d687","bugs":{"url":"https://github.com/axelboberg/puppeteer-screen-recorder/issues"},"_id":"@axelboberg/puppeteer-screen-recorder@2.1.0","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-SJ2zBthu3k+fZ4+YPyk63/iCk9U8Fl3lzEnHOcMuUImSH2C+WKY3sayVYyBq852uDlP6nQlqpfLwEJbRkhH/yQ==","shasum":"9d2392a10c2e377554d99a2c44af08a319736160","tarball":"https://registry.npmjs.org/@axelboberg/puppeteer-screen-recorder/-/puppeteer-screen-recorder-2.1.0.tgz","fileCount":32,"unpackedSize":171336,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBhp833+cD8ZdQgS/hBK989BGdK9wZBWTo2Ef2GPM5pwAiBJ9EPDzoFsFp2d3UUL7I9IZcW3MECkn3aFP/FaX0NZBQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjAZeZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmotog//UczZQzuBnhzTOPYTuPD9gc/d7biD4vLdWTLr0F4qAaJk5MKy\r\nva2JNTCCAP5a4W63lRfmxPTJYOQmMKfWYXjQswKpwMisu0Mfh4ruAR42a6sN\r\nlPG+jAuDz3yUUyiLEPmUY8V1QTSX1qyLdvC/Bu9OOuLOvqoR2NMTOE8soD36\r\nPcmhDUzS4qD0sP/3aaTX8o0nhiAtrqLYdeyCllxsaJBmGDGi2JSKR6XiMWhd\r\nkOcdPxZoXbFPsvpeFeO/E86cQ3Y7D7HhFDNHo48KDZTDE7E4SNB2pQma8tpA\r\nwLKt4HrxpZNJSch2qPWTZadhaLizuDbg7BYKdatSW5X4ZxuvFc7zszJTLY52\r\nyRKbkRXX1B7ZL/QJGsyLM86fL+QTqcLpOqclKcbZqKNaiYbkDtJqxkqmNWGA\r\nJWj5brHR9baQCF2uyp4rbJbewcrNZYBJKCkvokmtMrH6p4vOcy087rQoO5Ld\r\nkjyu3w85ZJJHwsw3+jJGs3cRxzz9pffrx3i9TynVVY46elxrMB1kPzDVjvR6\r\nUW6nY3HKaRyQ/ttoh+XEzVDeayLFB6XTyCEbjR4h2y7m6JgUpgYFYKub6h0s\r\nA3Vc8O0BVoRXFpV9A69Gebd9z/yugH1Gm9cAYUAhEvhAXDdzAzPDn6/Mgyy6\r\nvOQY9HZ5jT96soqkXGtxUHSAGOW/3YAFAm4=\r\n=VsIi\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"axelboberg","email":"hello@axelboberg.se"},"directories":{},"maintainers":[{"name":"axelboberg","email":"hello@axelboberg.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-screen-recorder_2.1.0_1661048729457_0.07064445235308603"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-21T02:25:29.401Z","2.1.0":"2022-08-21T02:25:29.661Z","modified":"2022-08-21T02:25:29.786Z"},"maintainers":[{"name":"axelboberg","email":"hello@axelboberg.se"}],"description":"A puppeteer Plugin that uses the native chrome devtool protocol for capturing video frame by frame. Also supports an option to follow pages that are opened by the current page object","homepage":"https://prasanaworld.github.io/puppeteer-screen-recorder/","keywords":["puppeteer","screen","screen recorder","video capture","video recorder","test case capture","video","record","cast","shot","video","record","puppeteer","pptr","pptr.dev","automatic","automation","screen cast","devtool","devtool protocol","screen frame","screeencast","screeencasts","screeenCasts","screeenCast","headless","headfull","FFMPEG"],"repository":{"type":"git","url":"git+https://github.com/axelboberg/puppeteer-screen-recorder.git"},"contributors":[{"name":"Axel Boberg","url":"hello@axelboberg.se"}],"author":{"name":"Prasana Kannan","url":"https://www.linkedin.com/in/prasanakannan/"},"bugs":{"url":"https://github.com/axelboberg/puppeteer-screen-recorder/issues"},"license":"MIT","readme":"# puppeteer-screen-recorder\n\nA puppeteer Plugin that uses the native [chrome devtool protocol](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-startScreencast) for capturing video frame by frame. Also supports an option to follow pages that are opened by the current page object. [Check out API Docs](https://prasanaworld.github.io/puppeteer-screen-recorder/classes/puppeteerscreenrecorder.html).\n\n[![NPM](https://nodei.co/npm/puppeteer-screen-recorder.png)](https://npmjs.org/package/puppeteer-screen-recorder)\n\n![GitHub](https://img.shields.io/github/license/prasanaworld/puppeteer-screen-recorder)\n[![Build Status](https://travis-ci.org/prasanaworld/puppeteer-screen-recorder.svg?branch=main)](https://travis-ci.org/prasanaworld/puppeteer-screen-recorder)\n\n![GitHub package.json version](https://img.shields.io/github/package-json/v/prasanaworld/puppeteer-screen-recorder)\n![GitHub top language](https://img.shields.io/github/languages/top/prasanaworld/puppeteer-screen-recorder)\n![npm](https://img.shields.io/npm/dt/puppeteer-screen-recorder)\n![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/puppeteer-screen-recorder)\n\n![GitHub forks](https://img.shields.io/github/forks/prasanaworld/puppeteer-screen-recorder?style=social)\n![GitHub Repo stars](https://img.shields.io/github/stars/prasanaworld/puppeteer-screen-recorder?style=social)\n![GitHub watchers](https://img.shields.io/github/watchers/prasanaworld/puppeteer-screen-recorder?style=social)\n![Twitter Follow](https://img.shields.io/twitter/follow/prasanaworld?style=social)\n\n<a href=\"https://github.com/prasanaworld/puppeteer-screen-recorder/issues/new\">Add Feature Request</a>\n\n</p>\n\n## Key Feature\n\n### 1. Follow Page Automatically\n\nAutomatically follows pages (multiple pages) which are opened at runtime, which will be part of video capturing. Also support options to disable the default flow.\n\n### 2. No overhead over FF_MPEG library\n\nFFMPEG library's installation and configuration are automatically managed by the library internally. Also offers options to configure with custom library path.\n\n### 3. Native Implementation\n\nThis plugin works directly with native [chrome devtool protocol](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-startScreencast) to capture the video under the wood without any other thirdparty puppeteer plugins for screen capturing.\n\n### 4. Adopted the Chromium principles\n\nAdopted Chromium principles such as Speed, Security, Stability and Simplicity. It also ensures no frames are missed during video capturing and doesn't impact the performance, since its doesn't use any other puppeteer plugin internally.\n\n### 5. Supports multiple video format and stream\n\nSupports multiple video format like AVI, MP4, MOV and WEBM. Enable support for writable or duplex stream for process the output streaming .\n\n## Getting Started\n\n### Installation Guide\n\nUsing Npm\n\n```sh\nnpm install puppeteer-screen-recorder\n```\n\nUsing Yarn\n\n```sh\nyarn add puppeteer-screen-recorder\n```\n\n### API Description\n\n**1. Import the plugin using ES6 or commonjs.**\n\n```javascript\n// ES6\nimport { PuppeteerScreenRecorder } from 'puppeteer-screen-recorder';\n\n// or commonjs\nconst { PuppeteerScreenRecorder } = require('puppeteer-screen-recorder');\n```\n\n**2. Setup the Configuration object.**\n\n```javascript\nconst Config = {\n  followNewTab: true,\n  fps: 25,\n  ffmpeg_Path: '<path of ffmpeg_path>' || null,\n  videoFrame: {\n    width: 1024,\n    height: 768,\n  },\n  videoCrf: 18,\n  videoCodec: 'libx264',\n  videoPreset: 'ultrafast',\n  videoBitrate: 1000,\n  autopad: {\n    color: 'black' | '#35A5FF',\n  },\n  aspectRatio: '4:3',\n};\n```\n\n> - **followNewTab** : Boolean value which is indicate whether to follow the tab or not. Default value is true.\n\n> - **fps**: Numeric value which denotes no.of Frames per second in which the video should be recorded. default value is 25.\n\n> - **ffmpeg_Path**: String value pointing to the installation of [FFMPEG](https://ffmpeg.org/). Default is null (Automatically install the FFMPEG and use it).\n\n> - **videoFrame**: An object which is to specify the width and height of the capturing video frame. Default to browser viewport size.\n\n> - **aspectRatio**: Specify the aspect ratio of the video. Default value is `4:3`.\n\n> - **autopad**: Specify whether autopad option is used and its color. Default to autopad deactivation mode.\n\n> - **recordDurationLimit**: Numerical value specify duration (in seconds) to record the video. By default video is recorded till stop method is invoked`. (Note: It's mandatory to invoke Stop() method even if this value is set)\n\n**3. create a new instance of video recording**\n\n```javascript\nconst recorder = new PuppeteerScreenRecorder(page, Config); // Config is optional\n\n// or\n\nconst recorder = new PuppeteerScreenRecorder(page);\n```\n\n> - **page**: Puppeteer page object which needs to captured.\n> - **config**: Config is an optional object.\n>   Default value is `{ followNewTab: true, fps: 25, ffmpeg_Path: null }`\n\n**4. Start Video capturing**\n\n**Option 1 - Start video capturing and save as file**\n\n```javascript\nconst SavePath = './test/demo.mp4';\nawait recorder.start(savePath);\n```\n\n**Option 2 - Start Video capturing using stream**\n\n```javascript\nconst pipeStream = new PassThrough();\nawait recorder.startStream(pipeStream);\n```\n\n> **pass**: Any writeable stream that will be an output for the stream recorder. Video is recorded and streamed with .mp4 extension.\n\n> **savePath**: string value indicating the directory on where to save the video. The path must also specify the name of the video with extension .mp4 (example - ./test/puppeteer-demo.mp4). Starting from v2, support added for extensions mp4, avi, mov and webm.\n\n**5. Stop the video capturing.**\n\n```javascript\nawait recorder.stop();\n```\n\n### Example\n\n```javascript\nconst puppeteer = require('puppeteer');\nconst { PuppeteerScreenRecorder } = require('puppeteer-screen-recorder');\n\n(async () => {\n  const browser = await puppeteer.launch();\n  const page = await browser.newPage();\n  const recorder = new PuppeteerScreenRecorder(page);\n  await recorder.start('./report/video/simple.mp4'); // supports extension - mp4, avi, webm and mov\n  await page.goto('https://example.com');\n\n  await page.goto('https://test.com');\n  await recorder.stop();\n  await browser.close();\n})();\n```\n\n## FAQ\n\nSome of the frequently asked question about puppeteer screen recording are\n\n**Q: Does it support Chrome in headless mode?**\n\n---\n\nYes, it supports Both headless and headFul mode.\n\nIt records full length video, frame by frame even when Chrome runs in headless mode.\n\n**Q: Does it support multiple extension?**\n\n---\n\nYes, Starting from version 2.0, support multiple extension like AVI, MP4, MOV and WEBM.\n\n**Q: Does it use the window object?**\n\n---\n\nNo, it's not tied to the window Object.\n\n**Q: Does it follows pages which are opened at runtime**\n\n---\n\nYes, it automatically follows pages which is created at runtime.\n\n**Q: is there an option to disable video recording for new page created and record video only for the page object passed**\n\n---\n\nYes, By setting the `options.followNewTab` to false, it record only video for the passed page object alone.\n\n**Q: Does it support to record video at 60 fps**\n\n---\n\nYes, video can be recorded at 60 fps. By setting `options.fps` to 60.\n\n**Q:Does it use the window object?**\n\n---\n\nNo, it doesn't use the window object.\n\n**Q: Does it use FFMPEG internally?**\n\n---\n\nYes, it uses FFMPEG with optimized options to speed up the video recording using stream from chrome devtool protocol.\n\n**Q: Does it support Webm?**\n\n---\n\nWebm format is supported.\n\n**Q: Is it possible to output the stream for further processing/enhancing?**\n\n---\n\nYes. By passing writable stream/duplex stream to `startStream` method.\n\n**Q: Can I limit the time of recording, like to stop after 2 minutes?**\n\n---\n\nBy specifying the time to record (in seconds) using `option.recordDurationLimit`\n\n**Q: Does it support audio recording?**\n\n---\n\nNo, it doesn't audio recording.\n\n**Q: Does it support GIF format, any plan to support in fur?**\n\n---\n\nNo, it wont support GIF. since Gif is considered as a image format.\n","readmeFilename":"README.md"}