WebRTC Samples getUserMedia ⇒ canvas ⇒ jpeg

Draw a frame from the video onto the canvas element using the drawImage() method, then convert it to a compressed image with .toDataURL and .toBlob.

The variables canvas, video and stream are in global scope, so you can inspect them from the console.

View source on GitHub