用户没有首先与文档进行交互

user didn't interact with the document first

我收到一个名为 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. 的错误 有谁知道如何解决这个问题?

const audioCls = new Audio("/assets/audio/a4.mp3");
setInterval(() => {
  audioCls.play();
}, 1000);

点击文档解决了问题:)