diff core.js @ 759:801e1977ab55

MUSHRA: Loading progress feedback
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Thu, 17 Dec 2015 16:29:49 +0000
parents 57a3cbf90e01
children 01c026742e1e
line wrap: on
line diff
--- a/core.js	Thu Dec 17 16:10:58 2015 +0000
+++ b/core.js	Thu Dec 17 16:29:49 2015 +0000
@@ -767,6 +767,7 @@
 		this.url = null;
 		this.buffer = null;
 		this.xmlRequest = new XMLHttpRequest();
+		this.xmlRequest.parent = this;
 		this.users = [];
 		this.getMedia = function(url) {
 			this.url = url;
@@ -807,7 +808,17 @@
 			this.progressCallback = function(event){
 				if (event.lengthComputable)
 				{
-					this.progress = event.loaded / event.total;
+					this.parent.progress = event.loaded / event.total;
+					for (var i=0; i<this.parent.users.length; i++)
+					{
+						if(this.parent.users[i].interfaceDOM != null)
+						{
+							if (typeof this.parent.users[i].interfaceDOM.updateLoading === "function")
+							{
+								this.parent.users[i].interfaceDOM.updateLoading(this.parent.progress*100);
+							}
+						}
+					}
 				}
 			};
 			this.xmlRequest.addEventListener("progress", this.progressCallback);