【发布时间】:2021-11-05 12:32:35
【问题描述】:
我打算在我的 js 代码中播放来自外部 url 的音频文件,但我在 google chrome 中不断收到 Uncaught (in promise) DOMException: The element has no supported sources. 和在 firefox 中出现 Uncaught (in promise) DOMException: The media resource indicated by the src attribute or assigned media provider object was not suitable. 的错误。
这是我的代码:
const sound = new Audio("https://soundcloud.com/saba-a-744718954/tick-1");
button.addEventListener("click", soundHandler);
function soundHandler() {
sound.play()
}
感谢您的帮助。谢谢。
【问题讨论】:
标签: javascript html web-audio-api