Its not possible to do this. Getting a youtube video as a dom video element is possible using the HTML5 embed option. The problem is youtube videos reside in an iframe, and due to cross-domain security restrictions, you will not be able to access the video dom element, which is necessary to draw it to a canvas.
screengrab from a youtube video in javascript
-
29-09-2022 - |
Question
I have a user requirement in which I want to take a screengrab of what is playing on a youtube video at the moment. I have read about rendering to canvas, but it seems to take dom elements, and not the current flash video position. Is this possible? I can't use browser extensions, it has to be a button on the site that does this.
Thanks in advance.
Edit: How about if I use the HTML5 renderer?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow