Open bausmeier opened 1 month ago
Context for this is that we're receiving error reports that just say 3
from which we can determine that it's related to decoding the audio, but doesn't give us much to go on. We're hoping that the actual error message will give us more to work with for debugging.
Issue/Feature
Prefer the
message
attribute on the error over thecode
attribute because it contains more specific diagnostic information.Related Issues
I couldn't find any.
Solution
The
message
attribute on theMediaError
object returned byHTMLMediaElement.error
contains specific diagnostic details about the error if available, or an empty string otherwise.If this message is available then it will be passed with the
loaderror
, otherwise the code will be passed as before.See https://html.spec.whatwg.org/multipage/media.html#error-codes.
Reproduction/Testing
Trigger a media error, and observe that a string message is provided to
onloaderror
instead of a code.The easiest option is to use a non-existent source:
Which will print something like
Failed to init decoder
instead of4
.Breaking Changes
The
onloaderror
was already being called with a message in most cases, so I wouldn't consider this a breaking change.