MediaError.code

The MediaError.code is a read-only unsigned short that represents the error:

Syntax

var myError = mediaError.code

Value

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.

Example

var obj = document.createElement('video');
obj.onerror = function() {console.log("Error with media: " + obj.error.code);}
obj.src="https://example.com/blahblah.mp4";

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'MediaError.code' in that specification.
Living Standard Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 3.5 (1.9.1) 9 ? ?
Feature Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) ? (Yes) (Yes)

See also

Document Tags and Contributors

 Contributors to this page: tbarber350, teoli
 Last updated by: tbarber350,