Skip to content

Instantly share code, notes, and snippets.

@OrderAndCh4oS
Created November 10, 2021 22:57
Show Gist options
  • Save OrderAndCh4oS/151e218138614e23d20f36f542810888 to your computer and use it in GitHub Desktop.
Save OrderAndCh4oS/151e218138614e23d20f36f542810888 to your computer and use it in GitHub Desktop.
Fetch audio src
fetchSrc = async(url, mimeType) => {
const audioResponse = await fetch(url, {
method: 'get',
headers: {'Accept': mimeType},
});
const blob = await audioResponse.blob();
audio.mimeType = mimeType;
audio.preload = 'metadata';
audio.src = URL.createObjectURL(blob);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment