Mercurial > hg > webaudioevaluationtool
comparison core.js @ 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 | 01c026742e1e |
comparison
equal
deleted
inserted
replaced
1395:41054721d136 | 1396:cfbe1252ff4c |
---|---|
765 this.bufferObj = function() | 765 this.bufferObj = function() |
766 { | 766 { |
767 this.url = null; | 767 this.url = null; |
768 this.buffer = null; | 768 this.buffer = null; |
769 this.xmlRequest = new XMLHttpRequest(); | 769 this.xmlRequest = new XMLHttpRequest(); |
770 this.xmlRequest.parent = this; | |
770 this.users = []; | 771 this.users = []; |
771 this.getMedia = function(url) { | 772 this.getMedia = function(url) { |
772 this.url = url; | 773 this.url = url; |
773 this.xmlRequest.open('GET',this.url,true); | 774 this.xmlRequest.open('GET',this.url,true); |
774 this.xmlRequest.responseType = 'arraybuffer'; | 775 this.xmlRequest.responseType = 'arraybuffer'; |
805 }; | 806 }; |
806 this.progress = 0; | 807 this.progress = 0; |
807 this.progressCallback = function(event){ | 808 this.progressCallback = function(event){ |
808 if (event.lengthComputable) | 809 if (event.lengthComputable) |
809 { | 810 { |
810 this.progress = event.loaded / event.total; | 811 this.parent.progress = event.loaded / event.total; |
812 for (var i=0; i<this.parent.users.length; i++) | |
813 { | |
814 if(this.parent.users[i].interfaceDOM != null) | |
815 { | |
816 if (typeof this.parent.users[i].interfaceDOM.updateLoading === "function") | |
817 { | |
818 this.parent.users[i].interfaceDOM.updateLoading(this.parent.progress*100); | |
819 } | |
820 } | |
821 } | |
811 } | 822 } |
812 }; | 823 }; |
813 this.xmlRequest.addEventListener("progress", this.progressCallback); | 824 this.xmlRequest.addEventListener("progress", this.progressCallback); |
814 this.xmlRequest.send(); | 825 this.xmlRequest.send(); |
815 }; | 826 }; |