There is an iframe
on this page I want to get a screenshot from the video
tag, so I have to reach video tag that in the iframe
tag.
When I open the console and run this code:
const videoElement = document.getElementsByTagName('iframe')[0]
.contentWindow.document.getElementsByTagName('video')[0];
//Extracting picture from video tag
const canvas = document.createElement('canvas');
canvas.width = videoElement.videoWidth;
canvas.height = videoElement.videoHeight;
canvas.getContext('2d').drawImage(videoElement, 0, 0, canvas.width, canvas.height);
This error has been thrown:
Uncaught DOMException: Blocked a frame with origin "https://developers.google.com" from accessing a cross-origin frame.
at <anonymous>:1:57
Also, I checked this question
My question is how can I get a screenshot from YouTube Player API?
vlc "https://www.youtube.com/watch?v=bHQqvYy5KYo" --rate=1 --video-filter=scene --vout=dummy --start-time=60 --stop-time=61 --scene-ratio=30 --scene-format=png --scene-prefix=screengrab_ vlc://quit
– Molal