The MediaError.code is a read-only unsigned short that represents the error:
var myError = mediaError.code
A constant that is one of the following:
| Name | Value | Description |
|---|---|---|
MEDIA_ERR_ABORTED | 1 | The fetching of the associated resource has been aborted by the user |
MEDIA_ERR_NETWORK | 2 | A network error caused the resource to stop being fetched. |
MEDIA_ERR_DECODE | 3 | A decoding error caused the resource to stop being fetched. |
MEDIA_ERR_SRC_NOT_SUPPORTED | 4 | The associated resource has been detected to be not suitable. |
var obj = document.createElement('video');
obj.onerror = function() {console.log("Error with media: " + obj.error.code);}
obj.src="https://example.com/blahblah.mp4";
| Specification | Status | Comment |
|---|---|---|
| WHATWG HTML Living Standard The definition of 'MediaError.code' in that specification. | Living Standard | Initial definition |
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | 3.5 (1.9.1) | 9 | ? | ? |
| Feature | Android | Edge | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | ? | (Yes) | (Yes) |
MediaError.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaError/code