我们如何指定音频/视频在HTML中准备好后将立即开始播放?
使用autoplay属性设置音频或视频将在页面加载时自动开始播放。
示例
您可以尝试运行以下代码以在HTML中实现自动播放属性-
<!DOCTYPE HTML>
<html>
<body>
<video width = "300" height = "200" controls autoplay>
<source src = "/html5/foo.ogg" type = "video/ogg" />
<source src = "/html5/foo.mp4" type = "video/mp4" />
Your browser does not support the video element.
</video>
</body>
</html>