“Screenshot JavaScript” Kode Jawaban

Cara mengambil tangkapan layar di browser menggunakan javascript

const screenshotTarget = document.body;

html2canvas(screenshotTarget).then((canvas) => {
    const base64image = canvas.toDataURL("image/png");
    window.location.href = base64image;
});
Attractive Anaconda

Screenshot JavaScript

let canvas = document.createElement('canvas');
let video = document.getElementById('my-video');
let image = '';

video.addEventListener('seeked', function(){
    canvas.width = 1920;
    canvas.height = 1080;

    let ctx = canvas.getContext('2d');
    ctx.drawImage( video, 0, 0, canvas.width, canvas.height );

    image = canvas.toDataURL('image/jpeg');
});

video.currentTime = TIME_IN_SECONDS;
Mr Kode-bin

Cara mengambil tangkapan layar di browser menggunakan javascript

const url2png = require('url2png')('API_KEY', 'PRIVATE_KEY');
const fs = require('fs');

app.get('/screenshot', (req, res) => {
	url2png.readURL(req.query.url, {}).pipe(fs.createWriteStream('screenshot.png'));
	res.json({success: true})
});
Attractive Anaconda

Jawaban yang mirip dengan “Screenshot JavaScript”

Pertanyaan yang mirip dengan “Screenshot JavaScript”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya