Created
January 17, 2022 03:22
-
-
Save toshvelaga/d9323a2286e0464ad29fa34dea4f8f9b to your computer and use it in GitHub Desktop.
puppeteerStream.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { launch, getStream } = require('puppeteer-stream') | |
| const fs = require('fs') | |
| // node arguments are present from the third position going forward. | |
| const args = process.argv.slice(2) | |
| const file = fs.createWriteStream(`./reports/videos/${args[0]}.mp4`) | |
| async function puppeteerStream() { | |
| const browser = await launch() | |
| const page = await browser.newPage() | |
| await page.goto('https://video-meeting-socket.herokuapp.com/room') | |
| await page.waitForSelector('button') | |
| await page.click('button') | |
| // records audio and video | |
| const stream = await getStream(page, { audio: true, video: true }) | |
| stream.pipe(file) | |
| await page.waitForTimeout(8000) | |
| await stream.destroy() | |
| await browser.close() | |
| file.close() | |
| } | |
| puppeteerStream() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment