/puppeteer-camera

Dockerized API for recording websites

Primary LanguageTypeScriptMIT LicenseMIT

Puppeteer Camera

How it works

  • Docker container starts an Express webserver
  • An HTTP /start request launches a headless Chromium browser with screen capture Chrome extension installed
  • The Chrome extension records the screen and audio output of any page
  • Data is streamed directly to S3 bucket in .webm format

Run

Add .env

AWS_REGION=us-west-2
AWS_ACCESS_KEY_ID=XXX
AWS_SECRET_ACCESS_KEY=XXX
AWS_PUPPETCAM_BUCKET_NAME=bucket-name
docker-compose up --build

Start recording a url

curl -X POST -H "Content-Type: application/json" -d '{"id":"abc123","url":"https://www.animaker.com"}' localhost:3333/start

Note: Reusing id will overwrite previous file

Stop recording a url

curl -X POST -H "Content-Type: application/json" -d '{"id":"abc123"}' localhost:3333/stop

Record Twilio Video

curl -X POST -H "Content-Type: application/json" -d '{"id":"abc123","url":"http://localhost:3333/?roomName=XXX&twilioToken=XXX"}' localhost:3333/start

See: index.tsx

Inspiration

See: https://github.com/muralikg/puppetcam