HTMLMediaElement: pause イベント

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

pause イベントは、動作の一時停止のリクエストが処理され、動作が一時状態に入ったときに送信されるものであり、メディアが要素の pause() の呼び出しを通して一時停止した後が最も一般的です。

イベントは pause() メソッドから戻り、メディア要素の paused プロパティが true に変化した後で一度送信されます。

このイベントはキャンセル不可で、バブリングしません。

構文

このイベントを addEventListener() などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。

js
addEventListener("pause", (event) => {});

onpause = (event) => {};

イベント型

一般的な Event です。

これらの例は、 HTMLMediaElement の pause イベントにイベントリスナーを追加してから、イベントが発生したことでイベントハンドラーが動作したときにメッセージをポストします。

addEventListener() を使用した例:

js
const video = document.querySelector("video");

video.addEventListener("pause", (event) => {
  console.log(
    "The Boolean paused property is now 'true'. Either the pause() method was called or the autoplay attribute was toggled.",
  );
});

onpause イベントハンドラープロパティを使用した例:

js
const video = document.querySelector("video");

video.onpause = (event) => {
  console.log(
    "The Boolean paused property is now 'true'. Either the pause() method was called or the autoplay attribute was toggled.",
  );
};

仕様書

Specification
HTML
# event-media-pause
HTML
# handler-onpause

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
pause event

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連イベント

関連情報