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

148
Visualizações
How to use ImageCapture in Vue.js?

I am trying to take a screenshot of the entire visible page of an Ionic Vue app, but I get the error "Cannot find name 'ImageCapture'".

const stream = await navigator.mediaDevices.getDisplayMedia();
      const screenVideoTrack = stream.getVideoTracks()[0];
      console.log("screenVideoTrack", screenVideoTrack);
      const capture = new ImageCapture(screenVideoTrack); // here the error occurs
      // when you need the still image
      const bitmap = await capture.grabFrame();
      // if you want a Blob version
      const canvas = document.createElement("canvas");
      if (!canvas) {
        console.error("no canvas created");
        return;
      }
      canvas.width = bitmap.width;
      canvas.height = bitmap.height;
      canvas.getContext("bitmaprenderer")?.transferFromImageBitmap(bitmap);
      const blob = await new Promise((res) => canvas.toBlob(res));

I did install the ""@types/w3c-image-capture": "^1.0.5"," via npm. The error occurs while compiling not while executing (cannot execute if not correctly compiled).

How do I mage Ionic Vue aware, that this type does exist?

Is there an alternative to take a screenshot of the entire page? (the lib 'html2canvas' is no option for me)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found a similar question to mine on StackOverflow and followed the answer given by Paweł Ciucias. I had to manually add the lib to the tsconfig.json file under 'compileroptions -> types'

"types": [
      "webpack-env",
      "jest",
      "w3c-image-capture"
    ],

The error now disappeared!

about 4 years ago · Juan Pablo Isaza Relatório
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