video和audio标签的属性(video和audio用法完全一样):
controls 该属性向用户显示控件,比如播放按钮
autoplay 视频在就绪后马上播放
loop 循环播放
preload 视频在页面加载时进行加载,并预备播放。如使用了 "autoplay",则忽略该属性。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!-- <video src="./cart.mp4" controls autoplay loop></video> -->
<!-- 视频 兼容性写法 -->
<video controls>
<source src="./cart.mp4" ></source>
<source src="./cart.ogg"></source>
<source src="./cart.WebM"></source>
</video>
<!-- <audio src="./listen.mp3" controls autoplay loop></audio> -->
<!-- 音频 兼容性写法 -->
<audio controls>
<source src="./listen.mp3"></source>
<source src="./listen.wav"></source>
</audio>
</body>
</html>