Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900