After I get audio file from input, I make it to url using ‘URL.createObjectURL’. And the url looks like ‘blob:http://127.0.0.1:8080/52090eca-64a0-4262-aeda-34f9c62257b1′. However, if I put this url to the src in audio tag, this shows nothing.
const file = event.detail.text[0].files[0] urlObj = URL.createObjectURL(file) <audio src={previewUrlObj} />
Advertisement
Answer
HTMLAudioElement class contains .play() function to open the sound, you need to call it example:
const audioTag = document.createElement("audio"); audioTag.src = "URL"; audioTag.play();