Firefox HTML5 Audio: Media resource could not be decoded (OnMediaSinkAudioError)
It turns out that in this scenario, the error is quite misleading, since it is caused by a misconfiguration of the Windows audio output device.
After swapping my headphones from the rear audio ports to the front and restarting the workstation, everything worked fine. Restarting Firefox may have also been sufficient.
I had the same problem more than once, this time after showing the Console (on Soundcloud) I saw the NS_ERROR_DOM_MEDIA_MEDIASINK_ERR
error logged and googled it to find this SO question. What fixed this issue for me was the 1st solution at drivereasy (restarting the Windows Audio service), without even restarting Windows or Firefox.
- Hold Down Windows logo and press R key. A Run dialog box will pop up.
- Type
services.msc
in the run box and click OK button. - In right Services Window, find Windows Audio from the “Name” list and right-click on it. Click Restart in the pop-up menu. Then the audio service will restart.
A cmd oneliner would be net stop AudioSrv && net start AudioSrv
, run as Administrator.
If you are using VS CODE Live Server extension, Javascript Audio() won't play sound. Try running the site without the extension.