【问题标题】:user didn't interact with the document first [duplicate]用户没有首先与文档交互[重复]
【发布时间】:2021-12-25 19:27:24
【问题描述】:

我收到一个名为 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);

【问题讨论】:

    标签: javascript audio


    【解决方案1】:

    点击文档修复了问题:)

    【讨论】:

      猜你喜欢
      • 2018-12-05
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 2021-03-04
      • 2020-05-02
      • 1970-01-01
      • 1970-01-01
      • 2021-05-21
      相关资源
      最近更新 更多