HTML and CSS Reference
In-Depth Information
socket.onmessage = function(event) {
if ( instanceof Blob) {
// 1. Get the raw data.
var blob =;
// 2. Create a new URL for the blob object.
window.URL = window.URL || window.webkitURL;
var source =
// 3. Update the image source.
video.src = source;
// 4. Release the allocated memory.
The code is similar to the one you used to drop an image on the HTML document.
There are two things to notice:
• You have created a reference for the <img> element, in order to constantly
modify its src property.
• After every src assignment, you release the image by calling the re-
vokeObjectURL function. This function cleans up the memory assigned to
the specified URL, and lets the browser know it doesn't need to keep the
URL's reference any more.
The following screenshot shows video streaming using consecutive frames:
Search WWH ::

Custom Search