I recently came across this website Design the next iPhone where after you click preset you have an option of downloading the video of 6s. As you can see below
in the past I’ve used the spite’s ccapture.js library for recording canvas to video using a fixed framerate. It is kind of dated, and generates WebM and PNGs sequences very well.
a more modern approach would be using html5 captureStream() method to grab canvas data and then record it using the MediaRecorder API. Please see this page from mozilla docs for details
This is the official example from WebRTC of how to record a HTML canvas and download it as a video.
ISSUE: a major issue I had with getting this right was to set the correct mimeType. For example : firefox support video/webm;codecs:vp9 but not video/webm;codecs=vp9
SOLUTION: After a lot of research, I got this resource which helps you find the correct mimeType in runtime for the respective browser.