Skip to content

Commit 93acbe5

Browse files
committed
i think this change wasn't necessary
1 parent 510b23c commit 93acbe5

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

lib/audio/AudioEngine.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,16 @@ export class AudioEngine {
6565
this.stop();
6666

6767
let arrayBuffer;
68-
6968
if (urlOrBlob instanceof Blob) {
7069
arrayBuffer = await urlOrBlob.arrayBuffer();
7170
this.currentAudioUrl = null; // Blob doesn't have a URL to track
7271
} else if (typeof urlOrBlob === 'string') {
7372
this.currentAudioUrl = urlOrBlob; // Track the URL
74-
if (urlOrBlob.startsWith('blob:')) {
75-
// Firefox blocks fetch() to blob URLs in certain security contexts;
76-
// XHR is more reliable for same-origin blob URLs.
77-
arrayBuffer = await new Promise((resolve, reject) => {
78-
const xhr = new XMLHttpRequest();
79-
xhr.open('GET', urlOrBlob);
80-
xhr.responseType = 'arraybuffer';
81-
xhr.onload = () => resolve(xhr.response);
82-
xhr.onerror = () => reject(new Error('Failed to load blob URL'));
83-
xhr.send();
84-
});
85-
} else {
86-
const response = await fetch(urlOrBlob);
87-
if (!response.ok) {
88-
throw new Error(`Failed to fetch audio: ${response.statusText}`);
89-
}
90-
arrayBuffer = await response.arrayBuffer();
73+
const response = await fetch(urlOrBlob);
74+
if (!response.ok) {
75+
throw new Error(`Failed to fetch audio: ${response.statusText}`);
9176
}
77+
arrayBuffer = await response.arrayBuffer();
9278
} else {
9379
throw new Error('Invalid audio source');
9480
}

0 commit comments

Comments
 (0)