Created
November 10, 2021 22:57
-
-
Save OrderAndCh4oS/151e218138614e23d20f36f542810888 to your computer and use it in GitHub Desktop.
Fetch audio src
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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