HTMLMediaElement: error イベント
error
イベントは、リソースがエラーのために読み込めなかったときに発生します(例えば、ネットワーク接続の問題など)。
バブリング | なし |
---|---|
キャンセル | 不可 |
インターフェイス | Event |
イベントハンドラープロパティ | onerror (en-US) |
例
const video = document.querySelector('video');
const videoSrc = 'https://path/to/video.webm';
video.addEventListener('error', () => {
console.error(`Error loading: ${videoSrc}`);
});
video.setAttribute('src', videoSrc);
仕様書
Specification |
---|
HTML Standard # event-media-error |
HTML Standard # handler-window-onmessageerror |
ブラウザーの互換性
BCD tables only load in the browser