Reputation: 735
I am trying to merge two audio files and play them.
I found this article which provide this approach:
let uris = ['file.mp3', 'file2.mp3'],
proms = uris.map(uri => fetch(uri).then(r => r.blob()));
Promise.all(proms).then(blobs => {
let blob = new Blob([blobs[0], blobs[1]]),
blobUrl = URL.createObjectURL(blob),
audio = new Audio(blobUrl);
audio.play();
});
However. Although a merged blob is created. the audio plays only the first file.
I'll appreciate a explanation/solution;
Thank You!
Upvotes: 0
Views: 287