简体   繁体   中英

HTML5 Audio not Playing Valid Source

I have a lot of audio tags that I'm loading onto a page (potentially hundreds) and some of them are correctly loading their src media, but others do not. The source media is completely valid and the elements that load and don't load are inconsistent. That is, some elements will load properly one time, but upon refresh they fail. I'm testing on Chrome.

Here's an example of one of the tags:

<li>
<h3>Episode 21: Daylight Saving</h3>
<audio src="http://traffic.libsyn.com/pragmatic/Pragmatic-E021.mp3" controls=""></audio>
</li>

This appears to be an odd memory issue. Setting preload = "none" on all of the audio elements seems to have fixed it. If you have fewer elements than I, you may be able to get away with preload = "metadata" .

It could be a memory problem or browser implementation problem. There is no easy diagnostic with the info provided. Try to use the "onError" attribute to log a detailed error into the (onError) callback. Try also to launch your browser from the console to see STDOUT/STDERR errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM