const screenshotTarget = document.body;
html2canvas(screenshotTarget).then((canvas) => {
const base64image = canvas.toDataURL("image/png");
window.location.href = base64image;
});
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;
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})
});