--- title: 'HTMLMediaElement: waiting イベント' slug: Web/API/HTMLMediaElement/waiting_event tags: - Audio - Event - HTMLMediaElement - Reference - Video - Web - イベント - ウェブ - 動画 - 音声 translation_of: Web/API/HTMLMediaElement/waiting_event ---
{{APIRef("HTMLMediaElement")}}

waiting イベントは、一時的にデータが欠落しているために再生が停止したときに発生します。

バブリング なし
キャンセル可能 いいえ
インターフェイス {{DOMxRef("Event")}}
対象 Element
既定のアクション なし
イベントハンドラープロパティ {{domxref("GlobalEventHandlers.onwaiting")}}
仕様書 HTML5 media

これらの例は、 HTMLMediaElement の waiting イベントのイベントリスナーを追加し、イベントの発生によりイベントハンドラーが動作したときにメッセージを登録します。

addEventListener() の使用:

const video = document.querySelector('video');

video.addEventListener('waiting', (event) => {
  console.log('Video is waiting for more data.');
});

onwaiting イベントハンドラープロパティの使用:

const video = document.querySelector('video');

video.onwaiting = (event) => {
  console.log('Video is waiting for more data.');
};

仕様書

仕様書 状態
{{SpecName('HTML WHATWG', "media.html#event-media-waiting", "waiting media event")}} {{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', "embedded-content-0.html#event-media-waiting", "waiting media event")}} {{Spec2('HTML5 W3C')}}

ブラウザーの互換性

{{Compat("api.HTMLMediaElement.waiting_event")}}

関連情報