Reputation: 131
I have something like this on page load:
echo "<td class='audio'><audio controls><source src></audio></td>";
I then make an ajax call based on click to pull relative audio URL's from an API I'm working with to be used as the src.
Upon visiting one of those audio URL's in a separate tab, the audio does in fact play. My thinking is that it's not playing where I need it to because it doesn't get a source until it needs it (used ajax to cut down on load time due to rather large API calls).
Any thoughts?
Upvotes: 1
Views: 285
Reputation: 985
This is work me,or may be you can remove the <source src="">
tag and add src=""
inside of the <audio>
tag
https://shty.ml?j2n7MxkhKm
When you enter this link then click the Preview
button
Upvotes: 0
Reputation: 67768
Your source
tag is missing the filetype information. Even is src
is replaced by src="your_path/your_file.mp3"
, it also needs for example type="audio/mpeg"
for an mp3-file. The full generated HTML code would have to be something like
<audio controls>
<source src="your_path/your_file.mp3" type="audio/mpeg">
</audio>
Upvotes: 0