Failed to load because no supported source was found. when playing HTML5 audio element [duplicate]

匆匆过客 提交于 2019-12-10 01:11:57

问题


I have HTML5 audio element

<audio src="/sounds/call.wav" id="audio1" repeated="0" repetitions="1" class="audio_sound"></audio>

If I try to call element.play() strange error appears in Chrome web console.

Uncaught (in promise) DOMException: Failed to load because no supported source was found.

I haven't found any clues why this error appears and how to fix it.


回答1:


This may or may not help, but I ran into the same error message on an .mp3 source file. I'd been updating the content and refining the mp3, not realising that the browser had cached the original version of the mp3 file (or part of it, at least). I can't find any info to back this up, but anecdotally it seems that part of the audio file might be cached and when the browser attempts to retrieve the rest of the file, it can't (or doesn't) retrieve a full working version.

I'd try renaming your .wav file to something you haven't used before and see if it starts working.



来源:https://stackoverflow.com/questions/37217606/failed-to-load-because-no-supported-source-was-found-when-playing-html5-audio-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!