Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 937
Sergii Bishyr Avatar asked May 13 '16 19:05

Sergii Bishyr


Video Answer


1 Answers

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.

like image 175
Andrew Serong Avatar answered Sep 19 '22 16:09

Andrew Serong