如何用JS实现播放时间的实时获取
发布网友
发布时间:2022-04-24 06:53
我来回答
共1个回答
热心网友
时间:2022-04-24 08:22
<!DOCTYPE HTML>
<html>
<head>
<meta charset=utf-8>
<title>audio</title>
<script>
onload = function(){
ado.addEventListener("timeupdate",function(){
console.log(this.currentTime);
});
ado.addEventListener("loadedmetadata",function(){
this.play();
});
}
</script>
</head>
<body>
<audio id="ado" src="/i/horse.ogg" controls="controls">
Your browser does not support the audio element.
</audio>
</body>
</html>