changeset 1396:cfbe1252ff4c

MUSHRA: Loading progress feedback
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Thu, 17 Dec 2015 16:29:49 +0000
parents 41054721d136
children 5c43c9e71be9
files core.js mushra.css mushra.js
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
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);
--- a/mushra.css	Thu Dec 17 16:10:58 2015 +0000
+++ b/mushra.css	Thu Dec 17 16:29:49 2015 +0000
@@ -50,11 +50,8 @@
 }
 
 input.track-slider-range {
-	width: 100%;
 	margin-left: 0px;
 	margin-right: 0px;
-	padding-left: 0px;
-	padding-top: 0px;
 }
 
 input[type=range][orient=vertical]
@@ -63,4 +60,5 @@
     -webkit-appearance: slider-vertical; /* WebKit */
     width: 8px;
     padding: 0 5px;
+    color: rgb(255, 144, 144);
 }
\ No newline at end of file
--- a/mushra.js	Thu Dec 17 16:10:58 2015 +0000
+++ b/mushra.js	Thu Dec 17 16:29:49 2015 +0000
@@ -195,7 +195,7 @@
 		console.log('slider '+id+' moved to '+this.value+' ('+time+')');
 	};
 	
-	this.play.textContent = "Play";
+	this.play.textContent = "Loading...";
 	this.play.value = audioObject.id;
 	this.play.style.float = "left";
 	this.play.style.width = "100%";
@@ -211,6 +211,7 @@
 	
 	this.enable = function() {
 		this.play.disabled = false;
+		this.play.textContent = "Play";
 		$(this.slider).removeClass('track-slider-disabled');
 	};
 	
@@ -229,6 +230,12 @@
 		this.holder.style.height = window.innerHeight-200 + 'px';
 		this.slider.style.height = window.innerHeight-250 + 'px';
 	}
+	this.updateLoading = function(progress)
+	{
+		progress = String(progress);
+		progress = progress.substr(0,5);
+		this.play.textContent = "Loading: "+progress+"%";
+	}
 	
 	if (this.parent.state == 1)
 	{