Each time you call createObjectURL(), a new object URL is created, even if you’ve already created one for the same object. Each of these must be released by calling URL.revokeObjectURL() when you no longer need them. Browsers will release these automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so.
Now, we can take a picture from our webcam, getting its content via a data URL. Here is the result of previous code:
In case we need to save the image server-side, we just need to send the canvas.toDataUrl() result using AJAX for instance.