Patrick Brosset on Nostr: The video.requestVideoFrameCallback() method is soon coming to all browsers. This ...
The video.requestVideoFrameCallback() method is soon coming to all browsers. This means you'll soon be able to run code on every frame of a playing <video>, which can be useful to, for instance, update a <canvas> at the same time.
Here's a quick demo video showing how I used this to compute the average color of a video frame (by dropping the frame into a canvas and getting the image color data), and set the page's background color to it.
{
"id":"e41dc3eb77a304d59c5dcc9f72f543d7ce439254fb7830d9cc8f36fe6366a719",
"pubkey":"83926e73155dd8e60b6722c3929bef3e9e119c966240695254a4ec03f134ee0b",
"created_at":1726756923,
"kind":1,
"tags": [
[
"proxy",
"https://mas.to/users/patrickbrosset/statuses/113164741752475477",
"activitypub"
]
],
"content":"The video.requestVideoFrameCallback() method is soon coming to all browsers. This means you'll soon be able to run code on every frame of a playing \u003cvideo\u003e, which can be useful to, for instance, update a \u003ccanvas\u003e at the same time.\n\nHere's a quick demo video showing how I used this to compute the average color of a video frame (by dropping the frame into a canvas and getting the image color data), and set the page's background color to it.\n\nhttps://media.mas.to/media_attachments/files/113/164/735/622/145/281/original/5bf3430cd812f46b.mp4",
"sig":"3db6d0f6a7174260c3d44278bd93c5603c0758c65d14503fbee771177ad169280c268c79bfb10aa77b8fcc3ec12855454b92d85affa542e7c8cd4368624ae7d0"
}