HTMLMediaElement: abort event - Web APIs | MDN

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js

addEventListener("abort", (event) => { })

onabort = (event) => { }

Event type

A generic Event.

Examples

js

const video = document.querySelector("video");
const videoSrc = "https://example.org/path/to/video.webm";

video.addEventListener("abort", () => {
  console.log(`Abort loading: ${videoSrc}`);
});

const source = document.createElement("source");
source.setAttribute("src", videoSrc);
source.setAttribute("type", "video/webm");

video.appendChild(source);

Specifications

Specification
HTML
# event-media-abort
HTML
# handler-onabort

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.