Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

178
Visualizações
Screen Recording Portion of Screen with JavaScript

I am attempting to implement a screen recorder in JavaScript that records a video feed rather than the entire screen. My question is whether or not this is possible using getDisplayMedia or if there is a library to achieve this. This is my current implementation, which will ask and record the entire screen.

const handleRecord = async () => {
    // console.log('record')
    let stream = await navigator.mediaDevices.getDisplayMedia({
      video: true
    })
    // Needed for better browser support 
    const mime = MediaRecorder.isTypeSupported("video/webm; codecs=vp9")
      ? "video/webm; codecs=vp9"
      : "video/webm"

    let mediaRecorder = new MediaRecorder(stream, { mimeType: mime })

    let chunks = []
    mediaRecorder.addEventListener('dataavailable', ({ data }) => chunks.push(data))

    mediaRecorder.addEventListener('stop', function () {
      let blob = new Blob(chunks, {type: chunks[0].type})
      let url = URL.createObjectURL(blob)
      let video = document.querySelector("#cameraFeed")
      video.src = url

      let a = document.createElement('a')
      a.href = url
      a.download = 'video.webm'
      a.click()
    })

    //we have to start the recorder manually
    mediaRecorder.start()
  }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda