Name

MediaError — an <audio> or <video> error

Synopsis

When an error occurs on an <audio> or <video> tag, an error event is triggered and the error property is set to a MediaError object. The code property specifies what kind of error occurred. The following constants define the values of that property.

Constants

unsigned short MEDIA_ERR_ABORTED = 1

The user asked the browser to stop loading the media.

unsigned short MEDIA_ERR_NETWORK = 2

The media is of the right type, but a network error prevented it from being loaded.

unsigned short MEDIA_ERR_DECODE = 3

The media is of the right type, but an encoding error prevented it from being decoded and played.

unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4

The media specified by the src attribute is not a type that the browser can play.

Properties

readonly unsigned short code

This property describes the type of media error that occurred. Its value will be one of the constants above.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.