MediaError - Web APIs 编辑

The MediaError interface represents an error which occurred while handling media in an HTML media element based on HTMLMediaElement, such as <audio> or <video>.

A MediaError object describes the error in general terms using a numeric code categorizing the kind of error, and a message, which provides specific diagnostics about what went wrong.

Properties

This interface doesn't inherit any properties.

MediaError.code
A number which represents the general type of error that occurred, as follows:
NameValueDescription
MEDIA_ERR_ABORTED1The fetching of the associated resource was aborted by the user's request.
MEDIA_ERR_NETWORK2Some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available.
MEDIA_ERR_DECODE3Despite having previously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error.
MEDIA_ERR_SRC_NOT_SUPPORTED4The associated resource or media provider object (such as a MediaStream) has been found to be unsuitable.
MediaError.message
A DOMString object containing a human-readable string which provides specific diagnostic information to help the reader understand the error condition which occurred; specifically, it isn't a summary of what the error code means, but actual diagnostic information to help in understanding what exactly went wrong. This text and its format is not defined by the specification and will vary from one user agent to another. If no diagnostics are available, or no explanation can be provided, this value is an empty string ("").

Methods

This interface doesn't implement or inherit any methods, and has none of its own.

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of 'MediaError' in that specification.
Living Standard 

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:100 次

字数:4045

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文