26

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.

Sergii Bishyr
  • 8,331
  • 6
  • 40
  • 69
  • 1
    this error meeeage seems to be related to a new feature in chrome 50 https://developers.google.com/web/updates/2016/03/play-returns-promise?hl=en – CodeToad May 26 '16 at 05:40
  • @CodeToad Looks like this is the error I'm getting. But does it appear? I cannot understand the reason and hot to avoid it. – Sergii Bishyr May 27 '16 at 06:22
  • I have yet to find a solution to this problem. I suspect it may be a chrome bug. Are you manipulating the video element with javascript, such as changing the src attribute after the page has loaded? I suspect this may be the reason why the error is occuring in my application. I am also going to try using a src tag inside of the audio element rather than a src attribute . have you tried that? – CodeToad May 29 '16 at 05:30
  • @CodeToad I've tried it but no positive results. Also I'm not changing src attribute. – Sergii Bishyr May 30 '16 at 20:19
  • 1
    This fixed the problem for me http://cnedelcu.blogspot.ca/2016/09/chrome-solution-for-domexception-failed-to-load-no-supported-source.html – Benoit Gauthier Oct 11 '16 at 01:27

1 Answers1

5

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.

Andrew Serong
  • 309
  • 4
  • 7