音频自动播放不工作HTML5 [英] audio autoplay not working html5
本文介绍了音频自动播放不工作HTML5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
东西真的akward的是我的code发生,音频自动播放不工作。
基本上,每一个网站code,我把这个code中的音乐自动播放,但在这其中是行不通的。
查找页脚code:
<页脚GT&;
< UL>
< H1>
&所述; A HREF =#>&下; IMG SRC =图像/ topoPirelli.pngALT =>&下; / A>
< / H1>
< / UL>
<音频类=音频循环自动播放=自动播放控制>
<信源SRC =1.oggTYPE =音频/ OGG>
<信源SRC =1.MP3TYPE =音频/ MPEG>
< /音频>
< /页脚>
< / DIV>
< /身体GT;
< / HTML>
解决方案
我有同样的问题。
我解决它在最终使用jQuery:
$('声音')。在('canplay',函数(){
this.play();
});
Something really akward is happening in my code, the autoplay for audio is not working.
Basically, every website code that i put this code the music autoplays but in this one is not working.
Find the footer code:
<footer>
<ul>
<h1>
<a href="#"><img src="images/topoPirelli.png" alt=""></a>
</h1>
</ul>
<audio class="audio" loop autoplay="autoplay" controls>
<source src="1.ogg" type="audio/ogg">
<source src="1.mp3" type="audio/mpeg">
</audio>
</footer>
</div>
</body>
</html>
解决方案
I had the same problem. I solved it by using jquery in the end:
$('audio').on('canplay', function() {
this.play();
});
这篇关于音频自动播放不工作HTML5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文