1.0.2 • Published 11 months ago

browser-screen-record v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

browser screen record

  <video id="preview" width="300px" autoplay></video> <br>
  <a id="download" download="file.webm">Download</a> <br> <br>
  <button id="start">start</button>
  <button id="stop">stop</button>
import BrowserScreen from 'browser-screen-record'

const screen = new BrowserScreen()

const start = document.querySelector("#start")
const stop = document.querySelector("#stop")

start.addEventListener("click", () => {
  screen.startRecord()
})

stop.addEventListener("click", () => {
  screen.stopRecord().then(blobURL => {
    const video = document.querySelector("#preview")
    const link = document.querySelector("#download")
    link.href = blobURL
    video.src = blobURL
    video.play()
  });
})

// Important! Use URL.revokeObjectURL(blobURL) after download