Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
//http://127.0.0.1:7070/PrjJsp/html5-audio/audio.html
//http://192.168.1.4:7070/PrjJsp/html5-audio/audio.html
function init()
{
var audio = document.getElementById('music1');
audio.play();
setTimeout(() => {
audio.pause()
audio.load()
}, 10);
}
</script>
</head>
<body onload="init()">
<audio id="music1" controls="controls" autoplay="autoplay" preload
id="music1" hidden>
<source src="BecauseofYou.mp3" />
</audio>
<!--这里是音乐-->
<img id="btn" class="active" src="music.png" alt="" />
</body>
&l