简体   繁体   English

HTML5音频未播放有效源

[英]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. 我有很多audio标签要加载到页面上(可能是数百个),其中一些标签正确地加载了src媒体,而其他标签则没有。 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. 我正在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. 在所有音频元素上设置preload = "none"似乎已解决了该问题。 If you have fewer elements than I, you may be able to get away with preload = "metadata" . 如果您的元素少于I,则可以使用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. 尝试使用“ onError”属性将详细的错误记录到(onError)回调中。 Try also to launch your browser from the console to see STDOUT/STDERR errors. 也尝试从控制台启动浏览器以查看STDOUT / STDERR错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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