hi all
I am using following code to download video i am getting blob data successfully but i am not able to calculate progress percentage. please assist me.
WinJS.xhr({ url: vurl, responseType: "blob" })
.done(function complete(result) {
//do something with blob
},
function error(error) {
//log error
},
function progress(result) {
if (result.readyState > 2) {
//var totalBytes = result.getResponseHeader('Content-length');
//var dlBytes = result.responseText.length;
//var per = (totalBytes > 0) ? (Math.round((dlBytes / totalBytes)
* 100) + "%") : (Math.round(dlBytes / 1024) + "K");
//$("#vmDownloadHeading").html("Downloading Media
" + per);
}
});
if i use response type as text i can calculate progress by above code, for other response it will be undefined so how to calculate the progress?
regards
vinay