Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73905

Take screenshot of streaming video js - tainted canvas error [duplicate]

$
0
0

I have to take screenshot of a streaming video, the source of videos are twist.moe. But when I execute my code with the 'canvas.toDataURL('image/png')', I got error of tainted canvas. enter image description here


setTimeout(() => {
    let video = document.querySelector('video').cloneNode(true);
    video.currentTime = 23;
    video.volume = 0;
    video.onloadeddata = () => {
        let canvas = document.createElement('canvas');
        canvas.width = video.videoWidth;
        canvas.height = video.videoHeight;
        canvas.crossOrigin = "Use-Credentials";
        canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
        document.body.append(canvas);
        document.body.append(canvas.toDataURL('image/png'));
    };
}, 1000);



Viewing all articles
Browse latest Browse all 73905

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>