HTMLMediaElement: abort event

资源没有被完全加载时就会触发 abort 事件,但错误不会触发该事件。

Bubbles No
Cancelable No
Interface Event
Event handler property onabort

示例

const video = document.querySelector('video');
const videoSrc = 'https://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);

规范

Specification Status
HTML Living Standard Living Standard
HTML5 Recommendation

浏览器兼容性

BCD tables only load in the browser

参阅