HTMLMediaElement: abort event
资源没有被完全加载时就会触发 abort
事件,但错误不会触发该事件。
示例
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 |
---|
HTML Standard # event-media-abort |
HTML Standard # handler-onabort |
浏览器兼容性
BCD tables only load in the browser