mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
Encode URL when loading buffer (#318)
* encode url in request when loading buffer * separate components by slash when encoding url * match indentation style * fix lint errors
This commit is contained in:
parent
77c7b85da5
commit
e6db1daed8
1 changed files with 12 additions and 1 deletions
|
@ -466,7 +466,18 @@ define(["Tone/core/Tone", "Tone/core/Emitter", "Tone/type/Type", "Tone/shim/Audi
|
|||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", Tone.Buffer.baseUrl + url, true);
|
||||
|
||||
// encode the url, separating by slash
|
||||
var urlSplit = (Tone.Buffer.baseUrl + url).split("/");
|
||||
var encodedUrl = "";
|
||||
for (var urlSplitIdx = 0; urlSplitIdx < urlSplit.length; urlSplitIdx++){
|
||||
if (urlSplitIdx > 0){
|
||||
encodedUrl += "/";
|
||||
}
|
||||
encodedUrl += encodeURIComponent(urlSplit[urlSplitIdx]);
|
||||
}
|
||||
|
||||
request.open("GET", encodedUrl, true);
|
||||
request.responseType = "arraybuffer";
|
||||
//start out as 0
|
||||
request.progress = 0;
|
||||
|
|
Loading…
Reference in a new issue