mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 03:53:07 +00:00
parent
c19723905e
commit
a77181175a
1 changed files with 4 additions and 0 deletions
|
@ -147,6 +147,10 @@ export class ToneAudioBuffers extends Tone {
|
|||
onerror: (e: Error) => void = noOp,
|
||||
): this {
|
||||
if (isString(url)) {
|
||||
// don't include the baseUrl if the url is a base64 encoded sound
|
||||
if (this.baseUrl && url.trim().substring(0, 11).toLowerCase() === "data:audio/") {
|
||||
this.baseUrl = "";
|
||||
}
|
||||
this._buffers.set(name.toString(), new ToneAudioBuffer(this.baseUrl + url, callback, onerror));
|
||||
} else {
|
||||
this._buffers.set(name.toString(), new ToneAudioBuffer(url, callback, onerror));
|
||||
|
|
Loading…
Reference in a new issue