changeset 2616:ac08e4a3a94b

#101.Mostly done. Loads up alternatives if one of them fails, until end of URL lists
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 15 Nov 2016 15:31:53 +0000
parents 8b8f3f3ce68e
children cce1fb4009f2
files js/core.js
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Tue Nov 15 15:27:45 2016 +0000
+++ b/js/core.js	Tue Nov 15 15:31:53 2016 +0000
@@ -1488,7 +1488,6 @@
 
     this.buffers = [];
     this.bufferObj = function () {
-        var currentUrlIndex = 0;
         this.urls = [];
         this.buffer = null;
         this.users = [];
@@ -1507,6 +1506,7 @@
         };
         this.getMedia = function (urls) {
             var self = this;
+            var currentUrlIndex = 0;
 
             function get(fqurl) {
                 return new Promise(function (resolve, reject) {
@@ -1530,7 +1530,7 @@
             function getNextURL() {
                 currentUrlIndex++;
                 var self = this;
-                if (currentURLIndex == this.urls.length) {
+                if (currentUrlIndex == this.urls.length) {
                     processError();
                 } else {
                     return get(this.urls[currentUrlIndex]).then(processAudio.bind(self)).catch(getNextURL.bind(self));
@@ -1593,7 +1593,6 @@
             };
 
             this.urls = urls;
-            currentUrlIndex = 0;
 
             this.progress = 0;
             this.status = 1;