Windows 8: How do you add src attribute to an img tag when image is a stream not a file

Windows 8: How do you add src attribute to an img tag when image is a stream not a file

Rate This
  • Comments 0

At runtime we may have file coming from sources like Web Cam. This is not a file at that point in time. It is just a stream. Now, if I am into a HTML WinJS app how can I add it?

Let’s you have a file with “myFile”.

//Make the temporary URL (HTML5)
//This URL is valid only within the context
var url = URL.createObjectURL(myFile);
var img = document.createElement("img");
//Then add the URL as src
img.src = url;

Namoskar!!!

Leave a Comment
  • Please add 7 and 4 and type the answer here:
  • Post